Home › Forums › Calendar Products › Events Calendar PRO › What do I replace deprecated Tribe__Events__Query with in this function snippet?
- This topic has 2 replies, 3 voices, and was last updated 10 years, 2 months ago by
Support Droid.
-
AuthorPosts
-
December 3, 2015 at 6:45 am #1034621
Cynthia Lockley
ParticipantTrying this again from Firefox. I kept getting logged out in Safari. Version 4 seems to have deprecated every Tribe__Events__ in the code. I’d like to find out what to use in my function before I install Version 4.
I noticed that one of the changes for Version 4 is “Deprecated – Removed some methods that have been deprecated since version 3.6 and earlier: tribe_events_single_event_meta, Tribe__Events__View_Helpers::[getMonthOptions, getDayOptions, getYearOptions], Tribe__Events__Query::posts_groupby, Tribe__Events__Main::[getRealStartDate, weekToDate, previousWeek]”
What am I supposed to change Tribe__Events__Query with in the following function snippet I got from Geof? (See tickets https://theeventscalendar.com/support/forums/topic/all-instances-of-recurring-events-are-showing-on-the-home-page-above-recent-news/ and
Here is the function:
<?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 at the top--with all the recent news posts below the future // events. // Not sure if the third function is really needed now because when the "Recurring events instances" was checked // on, that code just gave a list of 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' ); } } ?>December 3, 2015 at 1:24 pm #1035022Nico
MemberHi Cynthia,
Thanks for reaching out to us! I’ve tried the above code locally with 4.0 versions of the plugins and I’m not seeing any notice or errors. I guess the specific method removed are not in use in the snippet (as far as I can see).
Best method to test this is to update the plugins in a staging site with the same (or similar) content and configuration as the live site. In this case I think the code is safe for update.
Please let me know if you have the chance to test it with the updated versions of the plugins,
Best,
NicoFebruary 18, 2016 at 8:32 am #1075912Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘What do I replace deprecated Tribe__Events__Query with in this function snippet?’ is closed to new replies.
