Home › Forums › Calendar Products › Events Calendar PRO › Showing only the events from one category
- This topic has 4 replies, 4 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
May 31, 2012 at 5:00 am #19990
Robert
ParticipantIs there a code, or other way, to show only the events from one category in a page?
Robert
May 31, 2012 at 3:01 pm #20016Jonah
ParticipantHi Robert, if you paste this code into your functions.php file you can filter what categories are displayed in the calendar:
/*-----------------------------------------------------------------------------------*/
/* Exclude a category from the calendar
/*-----------------------------------------------------------------------------------*/add_action( 'pre_get_posts', 'exclude_events_category' );
function exclude_events_category( $query ) {if ( $query->query_vars['post_type'] == TribeEvents::POSTTYPE && $query->query_vars['eventDisplay'] == 'month' && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'tax_query', array(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'field' => 'slug',
'terms' => array('presentations'),
'operator' => 'IN'
)
)
);
}return $query;
}
Make sure to change ‘presentations’ to the name of your category.
– Jonah
June 1, 2012 at 12:09 am #20034Robert
ParticipantThat’s not what I want.
I want to show only 1 category in a page, not on the calender.
I want to show everything on the calender.
I want to take out 1 category and show it on a different page, let’s say page1.Robert
June 1, 2012 at 12:30 pm #20058Rob
MemberHi there Robert. Thanks for the follow-up; sorry to hear that didn’t meet your needs. If you wanted to show specific categories within your content (but independent of the broader calendar) you may want to check out our template tag documentation, as it should point you in the right direction to do so. That can be found at https://theeventscalendar.com/support/documentation. We also just published a themer’s guide that is pretty in-depth and may help you out. It’s at https://theeventscalendar.com/themers-guide-to-the-events-calendar/.
Good luck! Let us know if you have any other questions from there.
July 7, 2015 at 6:20 am #976987Support 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 ‘Showing only the events from one category’ is closed to new replies.
