dededey
6/28/2016 - 1:52 PM

breadcrumbs for custom taxonomy of custom post

breadcrumbs for custom taxonomy of custom post

<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>	
<?php 
$parent = null;
$child = null;
$terms = get_the_terms( $post->ID , 'line' );
// var_dump($terms);exit();
foreach ($terms as $t) {
	if($t->parent == 0){
		$parent = $t->name;
	}else{
		$child = $t->name;
	}
}


 ?>
<div id="breadcrumbs">
	<a href="<?php echo get_site_url(); ?>">Home</a>
		<span class="raquo">»</span>
		<?php echo $parent; ?>
		<?php if ($child!=null) { ?>
			<span class="raquo">»</span>
			<?php echo $child; } ?>
</div> 
<!-- end #breadcrumbs -->
<?php endwhile; // end of the loop. ?>