Home › Forums › Calendar Products › Events Calendar PRO › Remove event category from list view
- This topic has 5 replies, 2 voices, and was last updated 6 years, 8 months ago by Jaap.
-
AuthorPosts
-
July 25, 2017 at 12:39 am #1325627JaapParticipant
Hi,
Since the last update the custom code to remove a category from a list view is no longer working. It’s this code:
dd_action( ‘pre_get_posts’, ‘tribe_exclude_events_category_month_list’ );
function tribe_exclude_events_category_month_list( $query ) {if ( isset( $query->query_vars[‘eventDisplay’] ) && ! is_singular( ‘tribe_events’ ) ) {
if ( $query->query_vars[‘eventDisplay’] == ‘list’ && ! is_tax( Tribe__Events__Main::TAXONOMY ) || $query->query_vars[‘eventDisplay’] == ‘month’ && $query->query_vars[‘post_type’] == Tribe__Events__Main::POSTTYPE && ! is_tax( Tribe__Events__Main::TAXONOMY ) && empty( $query->query_vars[‘suppress_filters’] ) ) {
$query->set( ‘tax_query’, array(
array(
‘taxonomy’ => Tribe__Events__Main::TAXONOMY,
‘field’ => ‘slug’,
‘terms’ => array( ‘oefenuur’ ),
‘operator’ => ‘NOT IN’
)
) );
}}
return $query;
What can I do to fix this?
Cheers,
JaapJuly 26, 2017 at 2:46 pm #1326638BarryMemberHi Jaap,
Sorry to hear it.
I do have to note first of all that we can’t typically provide in-depth support for custom code and, even if this was sourced from a staff reply or a knowledgebase article, please do understand that the intent is generally to get you started — realistically, we can’t commit to ongoing support and maintenance of every snippet of code that’s out there.
I’ll be happy to try and point you in the right direction if I can, though. To start with, can you point me to the source of this code?
Thanks!
July 28, 2017 at 1:12 am #1327320JaapParticipantHi,
I got it from here: https://theeventscalendar.com/support/forums/topic/hide-category-from-main-calendar-but-not-category-calendar/
Cheers,
JaapJuly 28, 2017 at 11:56 am #1327632BarryMemberThanks for clarifying, Jaap.
The snippet basically seems sound to me and it works locally (of course, I need to change the category slug to something that matches my local data, but otherwise it’s fine).
In your case you seem to be targeting categories with the slug “oefenuur” – but when I visit the archive for that event category I see no upcoming events. Might that explain why it seems to have no effect?
August 19, 2017 at 9:35 am #1337756Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Remove event category from list view’ is closed to new replies.