hi,
sorry but can I know where are you trying to use the above snippet?
As a conditional to do some stuff. That appears on my front page within a query.
I just would like to know what the best way to check against a term (specifically a category) is?
The event category is saved within the EM_Event Object, so you cannot retrieve is with a simple “get_term()”.
You will first have to get into the correct Object.
Please post your full query so we can look what exactly needs be altered. A very small part is just not clear enough 😉
Also, please provide a link to the front page you are speaking of. It really helps.
Relevant part bolded
while ( $loop->have_posts() ) : $loop->the_post();
$thumb_id = get_post_thumbnail_id();
$hello = get_post_meta($post->ID, 'event_id', true);
$thumb_url = wp_get_attachment_image_src($thumb_id, 'slider1', true)
***RELEVANT PART***
if(has_term( 7, 'term_id' )) {
$hideexcerpt = " no-excerpt";
} else {
$hideexcerpt = "";
}
if(has_term( 8 )) {
$hidetitle = " no-title";
} else {
$hideexcerpt = "";
}
***END RELEVANT PART***
$content .= '<li><div class="slider-post ';
$content .= '"><a href="';