I can't add a pagination to divide my posts between pages and navigate between pages. Currently all 20 posts I have loads at once. I want to add a pagination to the bottom of my Page and view posts by 5.
I have a custom post type that I defined as Project. I have 2 pages. Homepage and Journal. Homepage features the feed of my Project post type and Journal features my regular blog posts. I want both of these pages to have pagination.
My current index.php which is my Homepage is as follows:
<?php get_header(); ?> <?php get_footer(); ?> <div class="portfolioBlock"> <?php $args = array('post_type' => 'project','posts_per_page' => 20 ); $loop = new WP_Query( $args ); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post(); get_template_part( 'content', get_post_format() ); endwhile; endif; ?> </div>
I am curious if this is caused because of my custom post types, would appreciate any help or lead to help me add a pagination to the page.
When i tried the Googled solution paginate_links I didn't get any links. I also tried previous_posts_link() and that gives me the links and I can move between pages, but each page reloads the same 20 posts, without any diving it up.
Thanks a lot!