Order events in main blog loop by post date (fails after updates)

Home Forums Calendar Products Events Calendar PRO Order events in main blog loop by post date (fails after updates)

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #1013535
    Jim
    Participant

    The Tribe-recommended code to achieve this doesn’t work. I’ve seen other recent reports of this, typically mentioning the recent WP and TEC updates getting to to 4.3.1, but no solutions. It did work earlier but now fails – future events always appear at above blog posts. Site info to follow.

    #1013536
    Jim
    Participant

    This reply is private.

    #1013659
    Brian
    Member

    Hi Jim,

    Thanks for using our plugins I can help out here.

    What version of the Events Calendar are you using?

    It Core at 3.12.3 and Pro at 3.12.2.

    If not can you please update to those versions and see if that helps.

    Let me know and we can go from here.

    Thanks

    #1013685
    Jim
    Participant

    It Core at 3.12.3 and Pro at 3.12.2.

    Confirmed

    Community is also installed at 3.12.2

    #1013688
    Jim
    Participant

    This reply is private.

    #1013815
    Brian
    Member

    Ok thanks.

    I took a look at your home page and not sure what I am looking for.

    Are the events suppose to appear under the latest updates?

    Did they ever show there?

    Let me know if I am in the right area and we can go from here.

    Thanks

    #1013915
    Jim
    Participant

    They will appear there but the actual blog page is at the link given previously: http://www.jimtovey.ca/news/

    The events are output in the loop along with other blog posts when you select “Include events in main blog loop”. Unfortunately, TEC events are output by event date, meaning any future event is ALWAYS the first item in the blog. Ten future events? your blog starts on page 3 or so.

    The other link I referenced (https://theeventscalendar.com/knowledgebase/order-events-in-main-blog-loop-by-post-date/) fixes this by outputting event posts by post date. The code provided fails, also as tested with twenty-fourteen and no other plugins. This is the problem – was working up until the slew of recent updates for WP and TEC.

    (A suggestion for improvement would be to add this as a user selectable option, right underneath “Include events in main blog loop”.)

    #1014054
    Brian
    Member

    Hi,

    I looked at that page and see two events and see what you mean.

    I not sure the coding was ever intended to work on a sub page as we usually meant that to be on the home page of the site as that is usually the main loop.

    The snippet works for me when testing on my home page. I cannot get a sub page to be considered the main loop.

    I also use Genesis, which your theme is a child theme of and the standard blog page does not show events for me.

    Do you have the coding that makes that page to be considered a main loop? I can try to help out if I have that, but otherwise I do not have anything else to fix it.

    Let me know.

    Thanks

    #1014614
    Jim
    Participant

    Thanks for your reply. The blog page is not a sub page, it also uses the main blog loop. The blog appears on that page as configured in “Dashboard> Settings > Reading > Front page displays > Posts page = <selected page>”. No code is required; no custom template is used.

    This is standard WordPress functionality and uses the main query. This is confirmed for Genesis here. (The typical Genesis “blog template” is not used.)

    #1014644
    Brian
    Member

    Oh Ok Thanks.

    That is simply enough.

    I tested out on my Genesis Child theme.

    The events correctly showed on the sub page and I was able to add the snippet and it reordered them as well. So it appears everything does work there.

    Can you confirm the snippet is running on your site and active on that page?

    If it is there could be a conflict somewhere else and running through our testing for conflicts guide could help narrow it down:

    Testing Conflicts With Themes and Other Plugins

    Let me know what you find out.

    Thanks

    #1014736
    Jim
    Participant

    Hi Brian,
    > Can you confirm the snippet is running on your site and active on that page?

    er… Sorry! I had actually been required to turn it off to allow other people to test. It is now back and active.

    I should also clarify the problem when the snippet is enabled: NO posts appear in the blog, instead “Sorry, no content matched your criteria.” is displayed without any post content of any type.

    I disabled all plugins and found that the only active plugin required to recreate the problem is: The Events Calendar Pro 3.12.2. When I disable Pro, the snippet works as expected, mixing the event posts inline with blog posts in descending date order.

    #1014902
    Brian
    Member

    Thanks for the info.

    I narrowed down the issue here.

    If this setting is checked:

    Events > Settings > General Tab > “Recurring event instances”

    And you add that snippet to reorder it breaks the main loop,

    Unchecking that fixed the issue for me when using that snippet.

    Let me know if that fixes it for you.

    I am seeing about getting an updated snippet that works when that setting is checked.

    Thanks

    #1015092
    Jim
    Participant

    Hi Brian,

    I see that this now allows the correct ordering in the blog loop.

    However, this introduces another unacceptable problem of equal magnitude where *every* occurrence of *every* recurring event appears in the blog – and each with the same posting date.

    Consider posting a weekly recurring seasonal event with a typical ~12 occurrences. This inserts 12 sequential posts into the blog, separating regular content by at least 2 *pages* of the *same* event with the *same* event date. It looks like event spam and drives away readers. For a site with multiples of recurring events it overwhelms the blog and makes the Pro plugin rather useless for recurring events.

    So neither option is a solution. Really looking forward to finding a proper correction for this.

    Thanks,

    #1015233
    Brian
    Member

    Hi,

    We are still looking into this. It is proving trickier to figure out then we thought.

    I will update this ticket once I have more information.

    Thanks

    #1015411
    Brian
    Member

    Hi,

    So we came up with this snippet:

    https://gist.github.com/barryhughes/60d1ad6cc849831b6fe0

    Replace the other snippet with that one.

    Then replace this:

    $query->set( 'order', 'ASC' );

    with this:

    $query->set( 'order', 'DESC' );

    We tested it and got it to work on one site. I tried it and it did not work the same for me, but we were unable to figure out why.

    Please let us know if it works for you.

    Thanks

Viewing 15 posts - 1 through 15 (of 18 total)
  • The topic ‘Order events in main blog loop by post date (fails after updates)’ is closed to new replies.