Home › Forums › Calendar Products › Events Calendar PRO › New post to my website is not showing up above an upconing event post
- This topic has 3 replies, 2 voices, and was last updated 10 years, 8 months ago by
Geoff.
-
AuthorPosts
-
August 20, 2015 at 8:32 pm #997804
Cynthia Lockley
ParticipantWe 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.
August 21, 2015 at 7:45 am #997935Geoff
MemberHi 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
August 21, 2015 at 11:45 am #998003Cynthia Lockley
ParticipantThank you! That did the trick.
August 21, 2015 at 4:28 pm #998105Geoff
MemberWoohoo! That’s awesome to hear. Thanks for confirming and sorry again for the trouble!
Geoff
-
AuthorPosts
- The topic ‘New post to my website is not showing up above an upconing event post’ is closed to new replies.
