Home › Forums › Back End › Pagination issue with Custom Post Types + Advanced Custom Fields › Reply To: Pagination issue with Custom Post Types + Advanced Custom Fields
May 19, 2014 at 12:31 pm
#170613
Participant
<?php
// Loop filtering by ACF field
wp_reset_postdata();
$myargs = array (
'post_type' => 'consultations',
'paged' => $paged,
'orderby' => 'title',
'order' => 'ASC',
'meta_key' => 'archive_item',
'meta_value' => 'No'
);
$myquery = new WP_Query($myargs);
if($myquery->have_posts() ) :
while($myquery->have_posts() ) : $myquery->the_post();
?>
<!-- Do you html stuff here -->
<?php
endwhile;
endif;
wp_reset_postdata();
?>
<?php if (show_posts_nav()) : ?>
<?php if ( get_previous_posts_link() ) { ?>
<span><?php previous_posts_link('« Newer consultations') ?></span>
<?php } ?>
<?php if ( get_next_posts_link() ) { ?>
<span><?php next_posts_link('Older consultations »') ?></span>
<?php } ?>
<?php endif; ?>