Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Display the description for the category/categories that are assigned to a single event. Requires Event Espresso 4. You can add this code to a <a href="http://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/">functions plugin</a> or into your WordPress theme's functions.php file.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_action( 'AHEE_event_details_before_the_content', 'ee_display_category_description_single_event' );
function ee_display_category_description_single_event( $post ) {
$taxonomy = 'espresso_event_categories';
$terms = get_the_terms( (int) $post->ID, $taxonomy );
if( !empty( $terms ) ) {
foreach( (array) $terms as $order => $term ) {
if( !empty( $term->description ) ) {
$description = $term->description;
echo '<p>' . $description . '</p>';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.