Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 512573

Help using the event calendar’s categories to output different logos

$
0
0

Replies: 0

Hi and thanks for taking your time in advance.

I run a page with 4 different sections, each having an own logo in the header. When using other custom post types such as ‘Portfolio’ for example, I use categories/custom taxonomies to differenciate between the sections. And then the following code to change the logo’s div class in single posts:

<? if ( is_singular( 'theme_portfolio' ) ) {
foreach((get_the_terms($post->ID, 'portfolio_category')) as $term) {
if($term->term_id == 16){
echo 'cultural';
}
}
}
?>

I’d like to do the same for single event posts within the Tribe Events Calendar, and I don’t get it to work. Using this code here…

<? if ( is_singular( 'tribe_events' ) ) {
foreach((get_the_terms($post->ID, 'tribe_events_cat')) as $term) {
if($term->term_id == 16){
echo 'cultural';
}
}
}
?>

…returns the following message:

Warning: Invalid argument supplied for foreach() in ../themes/theme/mod_logo.php on line 314

I tried tribe_get_event_cat_ids or tribe_get_event_cat without success. And if, then only within the loop. The plugin’s documentation wasn’t really helping either.

I would be very grateful for any help.

Thanks!

Lauren


Viewing all articles
Browse latest Browse all 512573

Trending Articles