I am having a little trouble trying to get my custom post type pagination to loop. The idea to my pagination is to only display a next field with the title of the next post. Once you hit the last post the pagination should now show the title of the first post. As of right now it stops at the last post and the pagination is hidden. What am I doing wrong to make it a loop?
<?php
$next_post = get_next_post();
if($next_post) {
$next_title = strip_tags(str_replace('"', '', $next_post->post_title));
echo "\t" . '<a rel="next" href="' . get_permalink($next_post->ID) . '" title="' . $next_title. '">' . "\n";
echo '<section id="nextService">';
echo '<ul id="serviceButton">';
echo '<li><p>Next Up</p></li>';
echo '<li><h2>'. $next_title . '</h2></li>';
echo '</ul>';
echo '</section>';
echo "</a>";
}
?>
Aucun commentaire:
Enregistrer un commentaire