I’m working on a site in WordPress using custom post-types via Advanced Custom Fields plugin. I’m stuck right now in terms of paginating the results for a gallery.
My site on page 1 of the gallery loads the posts, however, it does not offer an option to go to page 2 of the site.
If I alter the URL to take me to page 2, the previous link shows up.
Would anyone be able to tell me why this happens? I’ve attached my code below. Thanks.
<?php
$posts = get_posts(array(
'post_type' => 'dog',
'numberposts' => 3,
'paged' => $paged,
));
if( $posts ): ?>
<?php foreach( $posts as $post ):
?>
<div class="dog">
<img draggable="false" src=<?php echo the_field('before_and_after_image'); ?>>
<p><?php echo the_field('dog_name'); ?></p>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="dogNav">
<li><?php previous_posts_link('Previous Page');?></li>
<li><?php next_posts_link('Next Page');?></li>
</div>