Instantly share code, notes, and snippets.
Last active
April 11, 2016 17:25
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 | |
$breadcrumbs_taxonomy = get_option( 'theme_breadcrumbs_taxonomy' ); // get taxonomy from theme options | |
$inspiry_breadcrumbs_items = inspiry_get_breadcrumbs_items( $post->ID, $breadcrumbs_taxonomy, false ); | |
$breadcrumbs_count = count( $inspiry_breadcrumbs_items ); | |
if ( is_array( $inspiry_breadcrumbs_items ) && ( 0 < $breadcrumbs_count ) ) { | |
?> | |
<div class="page-breadcrumbs"> | |
<nav class="property-breadcrumbs"> | |
<ul> | |
<?php | |
$breadcrumbs_item_index = 1; | |
foreach( $inspiry_breadcrumbs_items as $item ) { | |
echo '<li>'; | |
if ( isset( $item[ 'url' ] ) && ! empty( $item[ 'url' ] ) ) { | |
?><a href="<?php echo esc_url ( $item[ 'url' ] ); ?>"><?php echo esc_html( $item[ 'name' ] ); ?></a><?php | |
} else { | |
echo esc_html( $item[ 'name' ] ); | |
} | |
$breadcrumbs_item_index++; | |
if ( $breadcrumbs_item_index <= $breadcrumbs_count ) { | |
if ( is_rtl() ) { | |
?><i class="breadcrumbs-separator fa fa-angle-left"></i><?php | |
} else { | |
?><i class="breadcrumbs-separator fa fa-angle-right"></i><?php | |
} | |
} | |
echo '</li>'; | |
} | |
?> | |
</ul> | |
</nav> | |
</div> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment