Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created April 18, 2016 15:14
Show Gist options
  • Save joshfeck/2df649a11c8cda58e69d478a74873808 to your computer and use it in GitHub Desktop.
Save joshfeck/2df649a11c8cda58e69d478a74873808 to your computer and use it in GitHub Desktop.
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