WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
Custom queries and how to avoid Jetpack Infinite Scroll to duplicate post (11 posts)

  1. g10r3
    Member
    Posted 1 year ago #

    Hi,

    I have a home page with some secondary queries. The queried post are then excluded from the main query of the page in order to avoid duplication of post with this function

    $args = array (
    		'posts_per_page' => 6,
    		'post__not_in'=>$list_ID_do_not_duplicate,
    	);
    
    query_posts($args);

    But when Infinite Scroll loads more post, it' seems that the pagination is broken and some post appears duplicated. I think that IS won't read that variable $list_ID_do_not_duplicate .

    Is there a way to pass this variable also to the query used by Infinite Scroll?

    Thank you so much,
    LG

    http://wordpress.org/extend/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    At this time, Infinite Scroll doesn't support custom queries within page templates, so I'm afraid you won't be able to use IS here.

    We're planning on adding support for custom queries in a future Jetpack update, but I don't have an ETA yet.

  3. g10r3
    Member
    Posted 1 year ago #

    Hi Jeremy,

    i was looking at the code of JetPack and found the "featured content" module.

    If I re-write my home page in order to use this module, i should not have any more problems with duplicated post, right?

    at line 185 is written that

    Exclude featured posts from the blog query when the blog is the front-page.

    and they will be excluded also from IS queries?

    There's some documentation available? It seems I can't find anything on jetpack website.

    Thank u

  4. Michael Fields
    Themer
    Posted 1 year ago #

    If I re-write my home page in order to use this module, i should not have any more problems with duplicated post, right?

    This is true.

    and they will be excluded also from IS queries?

    This is also true.

    There's some documentation available?

    Not at the moment unfortunately. I'll work on getting documentation posted to jetpack.me as soon as possible.

  5. g10r3
    Member
    Posted 1 year ago #

    Thank u Michael!

  6. ngoodfellow
    Member
    Posted 11 months ago #

    Is there an update to this yet??? My website currently uses a randomize plugin that uses query_posts( to sort the data randomly ) as well as another custom function to randomize when paged.

    Problem is, I am getting duplicate posts on infinite scroll when sorting this way! Can you please help?

    it seems I just need to pass the order= variable

    my website is:
    http://zombieprepkit.com

  7. ngoodfellow
    Member
    Posted 11 months ago #

    After doing some testing it appears as though this is how things load with infinite scroll on my site with random post order displayed as default=

    Default Home Page - Loads Content Properly for this as page 1
    Infinite Scroll - Paged 1 - reloads content properly with this as page 1
    Infinite Scroll - Paged 2 - reloads content properly with this as page 2
    Infinite Scroll - Paged 3 - reloads content properly with this as page 3

    so... is there a way to, when using infinite scroll, force it to load the page through infinite scroll for the first loop and continue from there?

    I will leave the example on http://zombieprepkit.com/?order=date for a day or two before I disable it again.

    I can provide the code that randomizes things if needed but its using a form that submits values to be used in a query_posts() array
    things are set by default to random and random posts are paged with a edit_posts_orderby statement that allows paged random posts to work... until Infinite Scroll is enabled!

    I tried actually replacing
    get_template_part( 'loop', 'index' );
    in my theme index file with:
    twenty_ten_infinite_scroll_render();

    but this didn't seem to work, still the first page seems to load 2x in and then everything else loads properly

  8. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 10 months ago #

    Hi ngoodfellow,

    There are some enhancements coming to IS soon which will allow for a greater range of query types. I can't specifically say which ones just yet, as they are still in development, but keep an eye out on our changelog to see what we're working on.

  9. ngoodfellow
    Member
    Posted 10 months ago #

    awesome, please do!

    It would be nice if WordPress updated the core setup of how the random posts are displayed on a custom query to automatically: randomize all posts and store random post order in a cookie so that duplicates are not seen when paged browsing. Currently, I had to modify my functions.php to get this functionality.

    If the core of wordpress had this fixed it would make displaying random posts much easier!

    ultimately I would prefer my home page to display all my posts in a random order, 7 at a time as you scroll down.

    one day this will be easily accomplished without having to do complex coding....

    in the meantime, check out my website! http://zombieprepkit.com

  10. kkalbat
    Member
    Posted 8 months ago #

    Any news about the Infinite Scrolling plugin for wp_Query ?

  11. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 8 months ago #

    We've made improvements to the Infinite Scroll module a couple of months ago, in r 777844-plugins. Infinite Scroll now supports a greater range of queries, so I would recommend that you try to install Jetpack 2.7 and see if it helps.

    If you still experience issues and if there are some queries where IS doesn't work, do not hesitate to start your own thread or send us an email with some details about what you'd like to achieve.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic