Skip to main content

Posts

Showing posts from February, 2016

Create an advance search page and result page with postmeta in wordpress

Create an advance search page and result page with postmeta in wordpress  step1    Create a new page in your theme with anyname like(ex - advanced-searchform.php) . and create a search form in it or paste this code <form method="get" id="advanced-searchform" role="search" action="<?php echo esc_url( home_url( '/' ) ); ?>">     <h3><?php _e( 'Search Products', 'textdomain' ); ?></h3>         <input type="hidden" name="search" value="advanced">     <br>     <input type="text" value="" placeholder="<?php _e( 'Type the Product Name', 'textdomain' ); ?>" name="productname" class="home_searchbox" />        <select name="sortby" id="sortby" class="themebtn">         <option value="post_title"><?php _e( 'Title', 

All Responsive Media queries with range

/* Smartphones (portrait and landscape) ----------- */ @media only screen and ( min - device - width : 320px ) and ( max - device - width : 480px ) { /* Styles */ } /* Smartphones (landscape) ----------- */ @media only screen and ( min - width : 321px ) { /* Styles */ } /* Smartphones (portrait) ----------- */ @media only screen and ( max - width : 320px ) { /* Styles */ } /* iPads (portrait and landscape) ----------- */ @media only screen and ( min - device - width : 768px ) and ( max - device - width : 1024px ) { /* Styles */ } /* iPads (landscape) ----------- */ @media only screen and ( min - device - width : 768px ) and ( max - device - width : 1024px ) and ( orientation : landscape ) { /* Styles */ } /* iPads (portrait) ----------- */ @media only screen and ( min - device - width : 768px ) and ( max - device - width : 1024px ) and ( orientation : portrait ) { /* Styles */ } /* Desktops and lapto

Register custom post type in Wordpress

Register custom post type in Wordpress add_action( 'init', 'create_post_type' ); function create_post_type() {   add_theme_support('post-thumbnails');   register_post_type( 'product',     array(       'labels' => array(         'name' => __( 'Products' ),         'singular_name' => __( 'Product' )       ),       'public' => true,       'has_archive' => true,       'supports' => array( 'title', 'editor','thumbnail', 'custom-fields' )     )   ); }

Show Custom type posts with pagination In WORDPRESS

Show Custom type posts with pagination In WORDPRESS                                        OR Custom Query results  with page-navi pagination in Wordpress                                        OR Show Custom Posts with meta value by custom query <?php /* Template Name: Search Page */ ?> <?php get_header(); ?>     <div id="wrap">         <div id="content">         <div class="clearfix"></div>                 <?php // Get data from URL into variables $_name = $_GET['productname'] != '' ? $_GET['productname'] : ''; $_model = $_GET['sortby'] != '' ? $_GET['sortby'] : ''; $_orderby = $_GET['orderby'] != '' ? $_GET['orderby'] : ''; global $wpdb; global $post; global $wp_query; // Pagination Setup /* $posts_per_page = 20; $start = 0; $paged = get_query_var( 'paged') ? get_query_var( 'paged', 1 ) : 1; // C

solution-wp_pagenavi Not Working for Page 2 on custom page WORDPRESS

if you use wp_pagenavi and your pagination not working in wordpress or Pagination not working with custom query OR WP-PageNavi not working properly on custom page SOLUTION 1 $args = array( 'post_type' => 'post', 'orderby' => 'date', 'posts_per_page' => 3, 'paged' => get_query_var('page'), ); query_posts( $args );   Changed it from paged to page in get_query_var. SOLUTION 2   function get_url_var($name) {     $strURL = $_SERVER['REQUEST_URI'];     $arrVals = split("/",$strURL);     $found = 0;     foreach ($arrVals as $index => $value)     {         if($value == $name) $found = $index;     }     $place = $found + 1;     return $arrVals[$place]; } $page = get_url_var('page'); if(is_numeric($page)) {     $countpage=$page; }else { $countpage = 1;  }  // ends here  //next pagination starts   $total_record = count($wpdb->get_results($search_query, ARRAY_A));     $paged