I’ve figured out a way to include breadcrumbs!!! I’ve provided the scripts I wrote below along with instructions!!! Enjoy! ??
I added the following code to the category.php tempate file
<a href="../../directory">Directory</a> // Replace with the page slug and name you use for the directory home page.
<?php
$product_terms = wp_get_object_terms($post->ID, 'listing_category');
$subs = ldl_get_categories(get_queried_object()->term_id );
if(($subs) || is_tax( 'listing_tag' )) { // tags doesn't have sub categories so we exclude them
echo '» '.get_queried_object()->name;
} else {
if(!empty($product_terms)){
if(!is_wp_error( $product_terms )){
foreach($product_terms as $term){
echo '» <a href="'.get_term_link($term->slug, 'listing_category').'">'.$term->name.'</a>';
}
}
}
}
?>
I added the following code to the single.php template file
<a href="../../directory">Directory</a> » // Replace with page slug and name you use for the directory home page.
<?php
$product_terms = wp_get_object_terms($post->ID, 'listing_category');
if(!empty($product_terms)){
if(!is_wp_error( $product_terms )){
foreach($product_terms as $term){
echo '<a href="'.get_term_link($term->slug, 'listing_category').'">'.$term->name.'</a> » ';
}
}
}
?><?php the_title(); ?>
SIDE NOTE::
If you are using sub categories and the bread crumb comes back as “Directory >> Sub-Category >> Parent Category >> Listing Title” you can make the following modification to the foreach loops:
foreach(array_reverse($product_terms) as $term){
Hope this helps!!