Created
April 18, 2016 15:14
-
-
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.
This file contains 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
<?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