Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Tests to see if the current event is assigned to the specified category or
- * categories.
- *
- * @param $ids int|array
- * @return bool
- */
- function tribe_in_category( $ids ) {
- $ids = (array) $ids;
- $categories = get_the_terms( get_the_ID(), TribeEvents::TAXONOMY );
- foreach ( $categories as $category )
- if ( in_array( $category->term_id, $ids ) )
- return true;
- return false;
- }
- // Conditional test that could be included in ecp-single-template.php
- if ( tribe_in_category( 4 ) ) echo 'Go category 4! Yeah!';
- else echo 'This category is for losers!';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement