All instances of recurring events are showing on the home page above recent news

Home Forums Calendar Products Events Calendar PRO All instances of recurring events are showing on the home page above recent news

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1027815
    Cynthia Lockley
    Participant

    I installed the update to .6 in my development site (http://dev.stcwdc.org/) before installing it in my production site (http://events.stcwdc.org/). Unfortunately, the latest update to .6 has messed up the order of events shown on the home page again.

    My home page shows the calendar and the collection of posts from the news posts and from the event posts. They are supposed to be displayed in the order written / published so that news posts are not pushed down below all future events. Having all future event posts take priority is not necessary–the upcoming events are listed in order in the sidebar widget. I need our recent news at the top. This was working with snippets from previous tickets but since the latest update, all instances of future recurring events are showing and some recent news posts are not showing (Competition deadline extended…), which show in the production site before the update.

    To see before update and after update results, compare the following PDFs.

    Production site working correctly before update to .6:
    http://dev.stcwdc.org/wp-content/uploads/WDCB-Events-News-before-update-18nov15.pdf

    Development site not working correctly after update to .6:
    http://dev.stcwdc.org/wp-content/uploads/WDCB-Development-after-update-18nov15.pdf

    I want all posts listed in the order they were published regardless if they are an event or a news post. In other words if two future events will occur one to two weeks from now, I want them listed below the news post I just wrote yesterday. Sometimes the news posts are about one of those future events, or it is important that users see it right away and not have to scroll through all future events to get to the current news posts.

    To accomplish this, I have been given snippets for the functions.php page but these stopped working in the previous releases. To fix that, I was advised to uncheck the “Recurring event instances” to get the functions working again as desired.

    Posts are getting posted in the wrong order.

    The update to .6 has kept the “Recurring event instances” unchecked but the functions to order the posts in the correct order and to only show one instance of recurring events are not working. The following are the function snippets I have that once worked:

    <?php
    //
    // *************************************
    // Events Calendar fix
    // Sort Events posts by creation / published date rather than start date
    // from Geoff’s second code in ticket at
    // https://theeventscalendar.com/support/forums/topic/posts-are-getting-posted-in-the-wrong-order/
    // NOTE: The “Recurring events instances” setting must be unchecked in the settings for this to work. Otherwise,
    // the two top functions just reorders future events to the top–with all the recent news posts below the future
    // events.
    // [If the “Recurring events instances” is checked on, the code lists all post categories starting with April 2007.
    // When the box is unchecked, I get what I want–all posts ordered by the date published –intermixing event posts
    // with news posts.]
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //

    add_action( ‘pre_get_posts’, ‘tribe_post_date_ordering’, 51 );

    function tribe_post_date_ordering( $query ) {
    if ( $query->tribe_is_multi_posttype) {
    remove_filter( ‘posts_fields’, array( ‘Tribe__Events__Query’, ‘multi_type_posts_fields’ ) ); $query->set( ‘order’, ‘DESC’ );
    }
    }

    add_action( ‘pre_get_posts’, ‘custom_teardown_tribe_order_filter’, 60 );

    function custom_teardown_tribe_order_filter() {
    if ( is_feed() ) remove_filter( ‘posts_orderby’, array( ‘Tribe__Events__Query’, ‘posts_orderby’ ), 10, 2 );
    }

    add_action( ‘pre_get_posts’, ‘order_by_modified’ );

    function order_by_modified( $query ) {

    if ( $query->is_home() && $query->is_main_query() ) {

    $query->set( ‘orderby’, ‘modified’ );
    }
    }
    ?>

    If I go into the settings and check the “Recurring events instances” box back on, I am back at the original problems I had earlier where the home page shows “Nothing Found
    Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.” instead of the calendar and news and event posts.

    I unchecked the box again but what do I need to do to get this to work as desired again?

    #1028201
    Nico
    Member

    Hey Cinthia,

    Thanks for reaching out to us! I’ll try to help you getting this right 🙂

    At first glance the code seems to be good, Can you please make sure it’s still in place after the update? Maybe you updated / changed the theme as well and it went away or something unexpected? If not I’ll give it a try locally and try to find where it’s failing.

    Thanks,
    Nico

    #1075711
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘All instances of recurring events are showing on the home page above recent news’ is closed to new replies.