New post to my website is not showing up above an upconing event post

Home Forums Calendar Products Events Calendar PRO New post to my website is not showing up above an upconing event post

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

    We have an event upcoming on August 29 that has an event post in the posts page. I wrote two new posts (news — not an event) which should show at the top of the list of posts and they are showing up below the August 29 and other upcoming event posts. This happened a few years ago and I was given a function to add to my child theme to sort the news posts and event posts in order when written instead of by start date. It seems that isn’t working since the latest updates to the plugin.

    <?php
    //
    // *************************************
    // Events Calendar fix
    // Sort Events posts by creation date rather than start date
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //
    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( 'TribeEventsQuery', 'multi_type_posts_fields' ) );
    $query->set( 'order', 'DESC' );
    }
    }
    ?>
    

    What do I need to do to make this work again?
    The posts are displayed on my home page at http://events.stcwdc.org
    The two event posts currently appearing above the latest news posts have not been marked to be stickies.

    I am using WordPress 4.3 and The Events Calendar Pro 3.11.1, The Events Calendar 3.11.2, and The Events Calendar: Eventbrite Tickets 3.11.1. I am using the Twenty Eleven theme with child adjustments. Everything worked correctly until the latest Events Calendar updates.

    Thanks.

    #997935
    Geoff
    Member

    Hi Cynthia and welcome back! Nice to see you again. 🙂

    Good question! We did recently refactor some of our code in the latest release which may have made an impact here. Give this a try instead and see if it helps do the trick:

    [php]
    <?php
    //
    // *************************************
    // Events Calendar fix // Sort Events posts by creation date rather than start date
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //
    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’ );
    }
    }
    ?>
    [/php]

    Sorry for the confusion here and I hope this helps!

    Geoff

    #998003
    Cynthia Lockley
    Participant

    Thank you! That did the trick.

    #998105
    Geoff
    Member

    Woohoo! That’s awesome to hear. Thanks for confirming and sorry again for the trouble!

    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘New post to my website is not showing up above an upconing event post’ is closed to new replies.