Created
January 26, 2018 17:50
-
-
Save qant/187749bf8e912688f32e23417b89d665 to your computer and use it in GitHub Desktop.
WordPress custom taxonomy breadcrumbs based on deepest term.
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 | |
global $post; | |
$inspiry_breadcrumbs_items = inspiry_get_breadcrumbs_items( $post->ID, 'property-type' ); | |
if ( is_array( $inspiry_breadcrumbs_items ) && ( 0 < count( $inspiry_breadcrumbs_items ) ) ) { | |
?> | |
<nav> | |
<ol class="breadcrumb"> | |
<?php | |
foreach( $inspiry_breadcrumbs_items as $item ) : | |
$class = ( !empty( $item['class'] ) ) ? 'class="' . $item['class'] . '"' : ''; | |
if ( !empty ( $item['url'] ) ) : | |
?> | |
<li <?php echo $class; ?>> | |
<a href="<?php echo esc_url( $item['url'] ); ?>"><?php echo $item['name']; ?></a> | |
</li> | |
<?php | |
else : | |
?> | |
<li <?php echo $class; ?>><?php echo $item['name']; ?></li> | |
<?php | |
endif; | |
endforeach; | |
?> | |
</ol> | |
</nav> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment