Hello readers, today we discuss wordpress pagination in Home Page or Front Page.
WordPress has the ability to split lists of articles, content, discussions or a single content into multiple pages "paged" navigation.
WordPress offers built-in function to navigate through the articles, content, discussions. Theme authors can make use of simple links for prior and next page, or perhaps numbered pagination.
Generally, We use paged pagination in blog page and other pages. But the paged pagination doesn't work on the home page or front page, when we put the same code into other page it works.
So I change the query for home page. Many developers face pagination not working on home page.
You can use the below code for the same.
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array(
'post_type' => 'myblog',
'posts_per_page' => 3,
'post_status' => 'publish',
'paged' => $paged
);
query_posts($args);
if(have_posts()){
while(have_posts() {
}
}
posts_nav_link();
wp_reset_query();
?>
I hope it helps you. Thank You readers.
0 Comment(s)