How do I make blog pagination work?
Introduction
In order to make pagination active on your blog pages, you must
set the limit
option (see What is the
Page Type and how do I use it? and Page Type
Options for Blog).
For example, if you want to break up your blog posts into pages
showing 3 posts per page, you would enter: limit=
3
Normally, this would limit the number of posts shown to only three. But, if you put the pagination template tags in your template, users will be able to navigate through all your posts.
It is important to note, however, that pagination will only be generated if there can be more than one page. So, in this case, if you have only three blog posts in all, then no pagination will be generated.
Where to put the pagination template tags
The pagination template tags should be placed in the layout_default.php file of your theme. The following snippet will make sure that the pagination is only displayed if the page type is Blog:
<?php if ( page_type() == "blog" ): ?>
<?php if ( blog_prev_page() ):?><a href="<?php echo blog_prev_page(); ?>">Prev page</a><?php endif; ?>
<?php echo blog_pagination(); ?>
<?php if ( blog_next_page() ):?><a href="<?php echo blog_next_page(); ?>">Next page</a><? endif;?>
<?php endif; ?>
Documentation for pagination template tags
-
FAQ
- What is the Page Type and how do I use it?
- How do I make blog pagination work?
- How can I make next/previous buttons to navigate my projects?
- How do I include Vimeo, YouTube, SoundCloud etc in my projects, pages, blog posts?
- How do I make excerpts for my blog posts? (Using the {more} tag)
- View all (2 more)
-
General Documentation
-
Themes
-
Code Documentation