In a Custom Post Type (ie: Lesson) and in that lesson template, you want to display the name of the taxonomy that it’s in – let’s say a Module.
Just the name of the parent taxonomy
// this one works to display the name of the current posts taxonomy title
add_action( 'genesis_before_sidebar_widget_area', 'parent_module_link' );
function parent_module_link () {
$terms = get_the_terms( $post->ID , 'module' );
foreach ( $terms as $term ) {
echo '<h4>' . $term->name . '</h4>';
}
}
The name of the parent taxonomy linking back to its archive page
//This will display a link and name of the parent module
add_action( 'genesis_before_sidebar_widget_area', 'parent_module_link' );
function parent_module_link () {
$terms = get_the_terms( $post->ID , 'module' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'module' );
if( is_wp_error( $term_link ) )
continue;
echo '<h4><a href="' . $term_link . '">' . $term->name . '</a></h4>';
}
}<