WordPress.org

Ready to get started?Download WordPress

Forums

JetPack Infinite Scroll on Search Results Page (17 posts)

  1. John Wilson
    Member
    Posted 11 months ago #

    I'm using JetPack Infinite Scroll on a new theme, and all is well. Except the search results page. By default, it didn't work on the search results page but I managed to fix that by using the infinite_scroll_archive_supported filter.

    function wh_infinite_scroll_support() {
    	$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || is_search() );
    	return $supported;
    }
    add_filter( 'infinite_scroll_archive_supported', 'wh_infinite_scroll_support' );

    However. When scrolling on to page two, the posts loaded are from the default loop as apposed to the second page of results from the search loop. It doesn't appear to be maintaining the search query string. Has anyone seen this before and know of a solution?

    Any help, greatly received.

  2. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    What happens when you try to switch to another theme, like Twenty Twelve? Do you still experience the issue?

    That would allow us to know if the problem is caused by Infinite Scroll or by the loop in your search template file, maybe.

    Let me know how it goes!

  3. John Wilson
    Member
    Posted 11 months ago #

    Yeah, when I add the above filter to Twenty Twelve via functions.php the same happens, page 2 shows page two of the main loop not page two of the search results.

    If I disable this filter & click more posts in Twenty Twelve, it shows the correct second page of results.

  4. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    I now recall this Infinite Scroll bug. We've been working on a fix in #1706-plugins. Could you try to apply the patch I just uploaded to your version of Jetpack?

    Let me know if it fixes the problem.

  5. John Wilson
    Member
    Posted 11 months ago #

    Well, I've done that. Changed both the infity.php & infinity.js and the same is happening. I tried using both my custom theme & Twenty Twelve and the problem persists in both.

  6. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    Thanks for trying! We're still working on it, so you might want to keep an eye on the ticket to follow our progress.

    I will pot again here as soon as the problem is fixed!

  7. John Wilson
    Member
    Posted 11 months ago #

    Righto, don't suppose you know how long it'll be? I'm sure there's a million & one other things on the list first, but worth a shot :)

    Thanks for trying & looking into it for me.

  8. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    I don't have an ETA I'm afraid, but you can add yourself in cc of the ticket I linked to earlier, and you'll receive an email every time one of us adds a comment, or commits a fix related to that ticket.

  9. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    Would you mind trying to replace your version of Jetpack with this one, and let me know if it helps?
    http://i.wpne.ws/QvdB

    Thanks!

  10. John Wilson
    Member
    Posted 11 months ago #

    We're getting closer. The More Posts link, when clicked appears to remember the search terms however the returned posts don't appear right, it's just repeating the first 3 posts again then breaks.

    Also, the infinite scroll only now seems to work on the homepage, it doesn't work on the taxonomy archives. Now, no longer displaying extra posts.

    Tried both these with TwentyTwelve too with different results. On the search, page two of the infinite scroll returns page 1's results again, then page 3 shows page two's results and so on.

    The infinite scroll works on the taxonomy archives just fine.

  11. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    Thanks for trying again!

    The patch does work on my test site, so I'm not sure why it doesn't work on your end. Did you make any changes to the Twenty Twelve theme, or do you use other plugins that may conflict with Jetpack?

  12. Jeremy Herve
    Happiness Engineer
    Posted 11 months ago #

    Could you also try to use this new version of Jetpack, including another patch?
    http://i.wpne.ws/Qy0a

    Thanks!

  13. John Wilson
    Member
    Posted 10 months ago #

    Sorry for the late reply, been away for a couple of weeks. Just downloading & trying this now. Will let you know how I get on.

    Cheers!

  14. noyz319
    Member
    Posted 9 months ago #

    Just checking if there have been any updates on this issue? I have the same problem and use the same code in my functions.php file. The infinite_scroll_archive_supported fix worked for the archives but not for is_search().

  15. nanoo_k
    Member
    Posted 9 months ago #

    I want to try this update as well but I don't want to muck things up by doing it wrong. I already have Jetpack installed, so do I manually upload the individual files or can I install these through the WordPress plugin installer?

  16. nanoo_k
    Member
    Posted 9 months ago #

    I tried updating my Jetpack, but it looks like I already have the most recent version ( v.2.5? ). Then I use this code to activate infinite scroll on search pages (it also deactivates infinite scroll in WooCommerce).

    function tweakjp_custom_is_support() {
        $supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_archive() || isset($_GET['site_section']) || is_search() ) && ( !is_woocommerce() );
    
        return $supported;
    }
    add_filter( 'infinite_scroll_archive_supported', 'tweakjp_custom_is_support' );

    The result is that the home page and archives scroll correctly but the search pages still load the homepage posts.

  17. Jeremy Herve
    Happiness Engineer
    Posted 9 months ago #

    @nanoo_k I'm afraid we haven't fixed this issue yet. You can follow our progress in this trac ticket:
    http://plugins.trac.wordpress.org/ticket/1706

Reply

You must log in to post.

About this Topic