-
I am using the built-in infinite scroll feature. However, when after activating filtering with Filter Everything, there is no infinite scroll. Do you think it is possible to fix that compatibility issue?
-
Hi there,
not sure, the issue will stem from what that plugin is doing to the sites markup and pagination.
If you can share a link to a page where I can see the issue, I’ll be determine if it can be fixed. -
Hi David,
Sounds good. Please check the link below. -
Hi there,
I just tested the plugin on my site and the infinite scroll works without any issue.
Can you disable all other plugins to test?
Let me know 🙂
-
Hi Ying,
I do not know what have changed, but now infinite scroll is also loading new posts at my site.
However, all posts are loaded by infinite scroll, and not only those in the filter query.
-
Not sure what you mean, how can I see the issue?
-
Hi Ying,
If I filter for a type (post category), the first posts are correctly from this category. However, it looks like the infinite scroll function is just loading all posts instead of using the same query.
See the video in the private area.
/ Peter
-
To cover; the theme adds pagination for the archive query when it gets loaded.
And that pagination has no knowledge of that plugin or what it is doing to the query.
So I can’t see a way to make the two talk without custom development. You might want to check with the plugin developer to see if they offer some kind of infinite scroll option. -
Hi David,
I think I do understand. However, the normal pagination buttons without infinite scroll does work fine.
When is the infinite scroll loaded in order to add the query parameters from the plugin?
/ Peter
-
ON page load, the infinite scroll script will scrape the pagination links on the page ( albeit they are hidden ). And its those links with he original query that it will use for its Ajax Loading.
-
I see. It makes sense now why it does not work.
Are there any filter to hook into in order to add the filter query to the infinite scroll query?
-
OK, so we use the following package:
We initialise the script in the plugins
blog/functions/js/scripts.js
Which includes getting the next link path:var hasInfiniteScroll = document.querySelector( '.infinite-scroll' ), nextLink = document.querySelector( '.infinite-scroll-path a' );
And that
.infinite-scroll-path a
element is set in:blog/functions/generate-blog.php
Where we hook the element in:
add_action( 'generate_after_footer', 'generate_blog_do_infinite_scroll_path', 500 ); /** * Add a next page of posts link for infinite scroll. * * @since 2.0.0 */ function generate_blog_do_infinite_scroll_path() { if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) { return; } $settings = wp_parse_args( get_option( 'generate_blog_settings', array() ), generate_blog_get_defaults() ); if ( $settings['infinite_scroll'] && ! is_singular() && ! is_404() ) { printf( '<div class="infinite-scroll-path" aria-hidden="true" style="display: none;">%s</div>', get_next_posts_link() ); } }
So in theory you can unhook the
generate_blog_do_infinite_scroll_path
callback ie.remove_action( 'generate_after_footer', 'generate_blog_do_infinite_scroll_path', 500 );
And hook in your own link….
-
Hi David,
I think the link should just have added the GET-parameters from the URL in the address bar at the moment of loading in infinite-scroll. However, as far as I can see in the JS-code, the nextLink variable is set on load and then “locked”. Is it possible to change the link after load?
Best Regards,
Peter -
You would need to unhook the function I mention above then hook in your own button, where you can amend the code to return the link thats required .
-
Hi David,
Yes, so far so good. However, the link will have to be changed with JS during the filtering. How can I tell the infinite scroll system to grab the new link instead of the (old) one found at the original page load?
Best Regards,
Peter -
I don’t see this being a simple workaround , I can see there being conflicts between the two ajax scripts running on the page. I think this would require a custom solution that is out of our scope. Perhaps the grid x plugin knows of a compatible solution where there plugin
- You must be logged in to reply to this topic.