Copy this to your functions.php file
3 | function postTypeCrumbs( $postType , $postTax ) { |
5 | $term = get_term_by( 'slug' , get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
6 | $taxonomy = get_taxonomy( $term ->taxonomy); |
7 | $parents = get_ancestors( $term ->term_id, $postTax ); |
8 | $parents = array_reverse ( $parents ); |
9 | $archive_link = get_post_type_archive_link( $postType ); |
11 | echo '<ul class="ax_crumbs">' ; |
14 | echo '<li><a href="' . $archive_link . '" title="' . $taxonomy ->labels->name . '">' . $taxonomy ->labels->name . '</a> » </li>' ; |
17 | foreach ( $parents as $parent ) { |
18 | $p = get_term( $parent , $postTax ); |
19 | echo '<li><a href="' . get_term_link( $p ->slug, $postTax ) . '" title="' . $p ->name . '">' . $p ->name . '</a> <span>»</span> </li>' ; |
23 | echo '<li>' . $term ->name . '</li>' ; |
Usage
Paste this whereever you would like the taxonomy to display.
1 | <?php postTypeCrumbs( 'post type' , 'taxonomy name' ); ?> |