crazyyy
3/6/2015 - 2:50 PM

wordpress custom post query with pagination

wordpress custom post query with pagination

<ul class="all-review-page">
  <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $temp = $wp_query;
    $wp_query= null;
    query_posts('post_type=reviews'.'&showposts=10'.'&paged='.$paged);
  while (have_posts()) : the_post();?>

  <li>
    <?php the_content(); ?>
    <p class="user-name"><?php the_title(); ?><span class="user-from user-from-<?php the_field('country'); ?>"><?php 
    $field = get_field_object('country');
    $value = get_field('country');
    $label = $field['choices'][ $value ];
    echo $label; ?></span></p>
  </li>


  <?php endwhile; ?>
  <?php html5wp_pagination(); ?>
  <?php $wp_query = null; $wp_query = $temp;?>
</ul><!-- all-review-page -->