Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. <?php
  2. $paged = ( get_query_var('paged')) ? get_query_var('paged') : 1;
  3.  
  4. $args = array(
  5. 'posts_per_page' => 2,
  6. 'paged' => $paged
  7. );
  8.  
  9. $consulta = new WP_Query($args);
  10.  
  11. if($consulta->have_posts()) :
  12. while ($consulta->have_posts()) : $consulta->the_post();
  13.  
  14. get_template_part('content', get_post_format());
  15.  
  16. endwhile;
  17.  
  18. wp_reset_postdata();
  19.  
  20. ?>
  21. <div class="pagination text-left">
  22. <?php next_posts_link("<< Older Posts", $consulta->max_num_pages) ?>
  23. </div>
  24.  
  25. <div class="pagination text-right">
  26. <?php previous_posts_link("Newer Posts >>"); ?>
  27. </div>
  28.  
  29. <?php else: ?>
  30. <p>Nothing here</p>
  31. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement