• When more than one post shares the same publish date and it is the last item in the initial load, all other items with that same date get skipped.

    The source of the issue seems to be line 449 of /modules/infinite-scroll/infinity.php:
    $operator = 'ASC' == $_REQUEST['query_args']['order'] ? '>' : '<';

    By changing that to $operator = 'ASC' == $_REQUEST['query_args']['order'] ? '>=' : '<=';
    It fixes the issue and does not cause duplicate posts.

    — Thanks for this amazing plugin, it has saved me so much time.

    edit – came up due to importing posts and having them all set to the same date.
    https://www.ads-software.com/plugins/jetpack/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Thanks for the report. We’ll get this fixed. You can follow our progress here:
    https://github.com/Automattic/jetpack/issues/1554

    Hi Jeremy,
    I’m having what I believe is a related issue, which might be different enough to cast that extra needed light on the bug.

    I’m in a local dev environment and to save myself the task of manually creating a bunch of new posts, I have imported Think Design’s “Test Post Pack“.

    Now, all of these imported posts have the same Published date, which is older than WordPress’ default “Hello World” post. So with that as the background, what I am seeing is just an infinite repetition of the “Hello World” post and none of the imported posts (screenshot). When I created a new post, Infinite Scroll just outputs it infinitely, instead of “Hello World”. So it seems to just be grabbing the latest post under these conditions.

    I’m running JetPack 3.3.2 and WordPress 4.1.1.

    Two additional findings.

    Firstly, as you may be able to make out on the screenshot in my last post, Infinite Scroll isn’t pulling the author, author link, or the entry content itself. It is pulling Categories, Tags, and Posted Date correctly.

    Secondly, as I’m continuing to test this, for simplicity’s sake, I removed all of the imported posts. I’ve manually added a handful of posts and set the published date manually to various dates earlier this year. Infinity Scroll still isn’t functioning as expected. But I’m seeing different behavior now: no more infinite posts, instead I see only the latest post (according to published date) repeated once, but it is being loaded before scroll.

    Now, here is where it gets interesting. I pull up the final source and locate the infiniteScroll Ajax stuff:

    var infiniteScroll = {"settings":{"id":"main", "ajaxurl":"http:\/\/localhost\/wordpress\/?infinity=scrolling", "type":"scroll", "wrapper":false, "wrapper_class":"infinite-wrap", "footer":true, "click_handle":"1", "text":"Older posts", "totop":"Scroll back to top", "currentday":"17.02.15", "order":"DESC", "scripts":[], "styles":[], "google_analytics":false, "offset":0, "history":{"host":"localhost\/wordpress", "path":"\/?paged=%d", "use_trailing_slashes":false, "parameters":""},
    "query_args":{"error":"", "m":"", "p":0, "post_parent":"", "subpost":"", "subpost_id":"", "attachment":"", "attachment_id":0, "name":"", "static":"", "pagename":"", "page_id":0, "second":"", "minute":"", "hour":"", "day":0, "monthnum":0, "year":0, "w":0, "category_name":"", "tag":"", "cat":"", "tag_id":"", "author":"", "author_name":"", "feed":"", "tb":"", "paged":0, "comments_popup":"", "meta_key":"", "meta_value":"", "preview":"", "s":"", "sentence":"", "fields":"", "menu_order":"", "category__in":[], "category__not_in":[], "category__and":[], "post__in":[], "post__not_in":[], "tag__in":[], "tag__not_in":[], "tag__and":[], "tag_slug__in":[], "tag_slug__and":[], "post_parent__in":[], "post_parent__not_in":[], "author__in":[], "author__not_in":[], "posts_per_page":3, "ignore_sticky_posts":false, "suppress_filters":false, "cache_results":true, "update_post_term_cache":true, "update_post_meta_cache":true, "post_type":"", "nopaging":false, "comments_per_page":"50", "no_found_rows":false, "order":"DESC"}, "last_post_date":"2015-02-17 08:31:01"}};

    See that last value? last_post_date is set to 2015-02-17 08:31:01. Remember I changed the Published Date? The Feb. 17 post is most recently created post, but it is not the latest Published Date (which is today’s date, of course). See closer to the beginning of this data, the value of currentday? It has 17.02.15. But the title of the post which Infinite Scroll is actually outputting (the only post data it is outputting) is today’s only post — not this “Feb. 17” post.

    Something weird is afoot. I wish I could be more helpful.

    Plugin Contributor Ryan C.

    (@ryancowles)

    @davegregg: Thanks for the additional info! I see that you commented on the GitHub Issue, too. I’d recommend keeping an eye on that Issue, so you can follow along with our progress there.

    Please don’t hesitate to let us know if you have any other questions in the meantime!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Infinite Scroll – Missing posts when they share a publish date’ is closed to new replies.