Created
August 9, 2016 12:50
-
-
Save tokopress/a5a0eff226bc5669b25c6711776cd501 to your computer and use it in GitHub Desktop.
Eventica - Exclude Some Event Categories on Frontend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'get_the_terms', 'tokopress_custom_exclude_event_categories_single', 10 ); | |
function tokopress_custom_exclude_event_categories_single( $terms ) { | |
$exclude = array( 261, 262 ); | |
if ( !is_admin() && !empty( $terms ) ) { | |
foreach ( $terms as $key => $term ) { | |
if ( $term->term_id && in_array( $term->term_id, $exclude ) ) { | |
unset( $terms[$key] ); | |
} | |
} | |
} | |
return $terms; | |
} | |
add_action( 'get_terms', 'tokopress_custom_exclude_event_categories', 10 ); | |
function tokopress_custom_exclude_event_categories( $terms ) { | |
$exclude = array( 261, 262 ); | |
if ( !is_admin() && !empty( $terms ) ) { | |
foreach ( $terms as $key => $term ) { | |
if ( $term->term_id && in_array( $term->term_id, $exclude ) ) { | |
unset( $terms[$key] ); | |
} | |
} | |
} | |
return $terms; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment