Archived topic
Different number of posts on the first page of the blog causes plugin error
5 replies · Started by Diogenes on May 15, 2020
Hi.
A few months ago Tom gave me a code that helped me limit the posts shown on the first page of the blog:
https://generatepress.com/forums/topic/different-number-of-post-in-first-page-of-blog-and-elementor/#post-957599
It was working fine, but recently I realized that this code affects the functioning of the Revive Old Posts plugin, since it limits the posts that are shared to the last 9 (which is the number that I defined in the code).
When I remove the code, Revive Old Posts behaves as it should, sharing all posts as configured.
It may have affected how it works since I implemented the code, but only now do I realize it.
I would really appreciate if you could help me.
Thank you.
So that code will only do something if:
1. It's the main query on the page.
2. It's not in the admin
3. It's the front page
4. It's not a paginated page
What exactly does that plugin do? It may be that it's simply not compatible with a pre_get_posts hook.
Let me know :)
Hi Tom, thanks for replying.
The Revive Old Posts plugin allows you to share old posts (this is configurable) published on the website on social networks, such as facebook or twitter.
I can't tell you if it supports pre_get_posts.
I'm going to post the code you gave me on their support forum, to see if they can give me any solution.
Sounds good - happy to help tweak it if I can once you get more info :)
Hi Tom.
The guys from Revive old post asked me to replace this part of your code:
if ( ! $query->is_paged && ! is_front_page() ) {
For this:
if ( ! $query->is_paged && ! is_front_page() && is_home() ) {
According to them, to make it more specific and will only affect the blog page.
That worked.
Thanks for your help.
Awesome, thanks for sharing the solution! :)