Advertisement
raselahmed7

Custom post query with pagination

Jun 26th, 2014
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.   $temp = $wp_query;
  3.   $wp_query = null;
  4.   $wp_query = new WP_Query();
  5.   $wp_query->query('showposts=6&post_type=consultant-items'.'&paged='.$paged);
  6.  
  7.   while ($wp_query->have_posts()) : $wp_query->the_post();
  8. ?>
  9.  
  10. <?php
  11.     $consultant_pic = get_post_meta($post->ID, 'consultant_pic', true);
  12. ?>
  13.  
  14. <div class="single_consultant">
  15.     <img src="<?php echo $consultant_pic; ?>" alt="" />
  16.     <?php the_content(); ?>
  17. </div>                             
  18.  
  19.  
  20. <?php endwhile; ?>
  21.  
  22. <?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { include('navigation.php'); } ?>
  23.  
  24. <?php
  25.   $wp_query = null;
  26.   $wp_query = $temp;  // Reset
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement