- This topic has 9 replies, 2 voices, and was last updated 7 months, 1 week ago by
Fernando.
-
AuthorPosts
-
August 22, 2022 at 6:50 pm #2320669
Vlad
Hello GP team,
On my website I use GeneratePress Pro and GenerateBlocks Pro (latest versions). The main page is split in two parts: in the upper part I have a query GenerateBlocks block (“magazine featured posts” by David) that displays 4 posts via block-hook in the “generate_inside_site_container” hook. In the lower part I have the default latest posts list with infinite scroll and the “load more” button activated.
The problem is there seems to be a conflict between the GP and the GB plugins: when I click on “load more”, new posts get added in the GB block container (upper part of the page, right beneath the 4 posts GB container) instead of being added at the bottom of the page. It’s a div withe the class “gb-inside-container”.
Also, the “load more” button now moves at the end of the new, malformed posts list instead of staying at the bottom of the page. However, if I remove the GB query block, the site works fine.
This is the only customization I made (no code whatsoever. I only used the GB and GP options). Any ideas on how I could solve this?
Thanks a lot,
VladAugust 22, 2022 at 10:13 pm #2320780Fernando Customer Support
Hi Vlad,
Can you try adding this filter?:
add_filter( 'post_class', function( $classes ) { $infinite_scroll_item_index = array_search( 'infinite-scroll-item', $classes ); if ( in_array( 'gb-query-loop-item', $classes ) && $infinite_scroll_item_index !== false ) { unset( $classes[ $infinite_scroll_item_index ] ); } return $classes; } );
Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets
August 22, 2022 at 10:53 pm #2320796Vlad
Hello Fernando,
Nice,it works!What if I decide to use the same GenerateBlocks block on a category or a tag archives page, with the same layout and settings?Will I need another fix or is this snippet enough to remove all potential conflicts between the GB blocks and the standard posts infinite queries?
EDIT: It only works on desktop. If I tap on “load more” on mobile, the button disappears and nothing happens.
Thank you,
VladAugust 22, 2022 at 10:59 pm #2320798Fernando Customer Support
The filter removes the infinte-scroll-item class if it is query loop item so that issue doesn’t occur in any archive page.
Our team is planning a fix to this issue in the next update. The filter is a temporary fix.
August 22, 2022 at 11:04 pm #2320807Vlad
I’ve just edited my last answer. The filter only works on desktop, on mobile the “load more” button disappears once I click on it and then nothing happens – no new posts are being loaded.
August 22, 2022 at 11:11 pm #2320820Fernando Customer Support
Can you try clearing cache or using a different mobile to test?
August 22, 2022 at 11:40 pm #2320838Vlad
You were right, Fernando. It was a caching issue – for some reason I had to clear the cache 3 times for my phones to use the new page settings.
Our team is planning a fix to this issue in the next update. The filter is a temporary fix.
Once the update is out, will I have to manually remove the filter, or will the update overwrite it anyway?
August 22, 2022 at 11:50 pm #2320843Fernando Customer Support
You can remove it manually after the update for the fix. Leaving it shouldn’t cause any issues as well.
August 22, 2022 at 11:51 pm #2320844Vlad
OK, thank you for your help, Fernando! Great support, as always. All the best!
August 22, 2022 at 11:56 pm #2320846Fernando Customer Support
You’re welcome Vlad!
-
AuthorPosts
- You must be logged in to reply to this topic.