Timeline for Blog posts pagination not working
Current License: CC BY-SA 4.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 20, 2021 at 11:12 | vote | accept | ddd | ||
May 20, 2021 at 11:06 | answer | added | anton | timeline score: 0 | |
May 20, 2021 at 10:41 | comment | added | ddd | Yes! Add it as your answer. Thank you! | |
May 20, 2021 at 10:38 | comment | added | anton |
If you manually set posts_per_page, try to use get_option( 'posts_per_page' ) to be able change it later on Reading Settings page. But glad your problem solved. I will add my comment as an answer, ok?
|
|
May 20, 2021 at 10:34 | comment | added | ddd | Hey @anton, it is working properly now. Just had to set the posts to 6 per page :) | |
May 20, 2021 at 10:29 | comment | added | anton | add your index.php code to your answer please | |
May 20, 2021 at 10:14 | comment | added | ddd | No, it doesn't have @anton | |
May 20, 2021 at 10:13 | comment | added | anton | Do you theme have front-page.php file? | |
May 20, 2021 at 10:11 | comment | added | ddd |
I see. index.php uses the_posts_navigation() . I revisited the Reading Settings and set the Blog pages show at most to 6 since my posts_per_page is 6 too. Pagination is now showing.
|
|
May 20, 2021 at 9:56 | comment | added | anton |
Actually not. From wp website about home.php: "If you do not set WordPress to use a static front page, this template is used to show latest posts.". So I think your blog page just uses another template. front-page.php if you have, or index.php . Try to use the_posts_navigation() there.
|
|
May 20, 2021 at 9:52 | comment | added | ddd |
No it is not checked @anton. In my case home.php is used on a separate static page.
|
|
May 20, 2021 at 9:43 | comment | added | anton | In your first code, you don't need to check total pages (the same check goes inside already), unless you need to hide wrapper div for navigation. Try to echo something in your home.php, just to make sure you see it on your home page. I asked this before, because home.php is used when "Your latest posts" is checked. | |
May 20, 2021 at 9:26 | comment | added | ddd |
Oh, home.php is automatically used on the posts page. This is my reference: wphierarchy.com @anton, I still cannot see why the pagination is not showing. Blogs are showing though. Something wrong with my if statement on displaying pagination?
|
|
May 20, 2021 at 9:17 | comment | added | anton | I don't think problem related to the_posts_navigation(), because it's native wp function. And I can't see your pages full code. Settings -> Reading -> Your home page displays is set to "Your latest posts"? | |
May 20, 2021 at 9:08 | comment | added | ddd |
Hi @anton , yes blog page uses home.php . I am trying to make global pagination. What would you suggest? Even if I remove the if exists condition, pagination won't still show.
|
|
May 20, 2021 at 8:55 | comment | added | anton |
1) Are you sure your blog page uses home.php template? 2) On template-tags.php you check if the_post_navigation exists, but it always exists, because it's wordpress function. Do you call it if it exists?
|
|
May 20, 2021 at 8:45 | history | asked | ddd | CC BY-SA 4.0 |