[Resolved] How activate infinite scroll for custom post type

Home Forums Support [Resolved] How activate infinite scroll for custom post type

Home Forums Support How activate infinite scroll for custom post type

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2177357
    Sebastian

    Hey guys,

    I have custom post type posts displaying in a section on my homepage (as cards in a custom 2 col layout). I solved that by using a hook with a wp_query, querying them all and then inserting it on the page with generate_before_main_content hook. I would like to enable infinite scroll for these because the amount of posts will most probably vary quite some.

    This is the simple query I’m using:

    <?php
    $homepageAdvisors = new WP_Query(array(
      'posts_per_page' => -1,
      'post_type' => 'radgivare'
    ));
    ?>

    Please tell me there is a simple way of making this work? ๐Ÿ™‚

    Thanks!

    #2177369
    David
    Staff
    Customer Support

    Hi there,

    the GP infinite scroll is built upon the paging navigation used on the archive templates.
    It cannot be simply used for a custom loop that is hooked into a page. You would need to find a custom solution for that which isn’t simple. Bill Erickson provides a method here:

    https://www.billerickson.net/infinite-scroll-in-wordpress/

    You may want to consider finding a plugin to do it instead though.

    #2178270
    Sebastian

    Ok, thanks for your input! I dug around and found “Ajax Load More” plugin which after some css tweaking does exactly what I want.

    However, I am a bit worried that this kind of implementation (placing content solely with the help of Ajax) will ruin the SEO for the page (or section at least). I’m not good at javascript, so David, what do you think about that? (Sorry for jumping around topics here)

    #2178326
    David
    Staff
    Customer Support
    #2198284
    Sebastian

    Thanks a lot!! Yes that is calming to read ๐Ÿ™‚

    #2198426
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.