Pagination on custom post types
-
Hello everyone.
I’ve set up two custom post types. For the sake of the example, I will call them ‘left’ and ‘right’.I have made an index.php in which I want to achieve the following:
- It should loop through the ‘left’ posts in the left div and
- It should loop through the ‘right’ posts in the right div.
- After every 5 posts it should display a “older posts” link.
From the codex I’ve been able to find this loop that I use for both (with ‘left’ and ‘right’ post types respectively):
$loop = new WP_Query( array( 'post_type' => 'left', 'posts_per_page' => 10 ) ); while ( $loop->have_posts() ) : $loop->the_post(); the_title(); echo '<div class="entry-content">'; the_content(); echo '</div>'; endwhile;
It goes through the posts just fine. But I don’t know how to make it insert the “older posts” link every 5 posts.
Can anyone help me out?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination on custom post types’ is closed to new replies.