hi kriesi team,
my current structure is
Products (parent product category)
- Bag (child product category)
- Bag 1 (a single product page)
Currently when i go to the single product page it shows:
Home » Products » Bag1
But I would like to show:
Home » Products » Bag » Bag1
I have an issue that is similar to this post
http://www.kriesi.at/support/topic/how-to-get-parent-category-in-breadcrumbs-on-the-single-product-page
I can only do front end design and this coding is not easy for me to grasp.
I tried going into the one of the referred links posted by Peter http://www.kriesi.at/support/topic/breadcrumbs-glitching-illogical-structure in one of the thread which is taking me to abundance\framework\php\class-breadcrumb.php
saw the codes that solved the issue, but cant figure out how to insert below codes given by Peter
---------------
$prod_cat = array();
$id = (int) get_the_ID();
$taxonomy = 'product_cat';
if ( !empty($id) && !empty($taxonomy) )
{
$args = array('orderby' => 'term_id', 'order' => 'ASC', 'fields' => 'all');
$prod_cat = wp_get_object_terms( $id, $taxonomy, $args );
wp_cache_add($id, $prod_cat, $taxonomy . '_relationships');
$prod_cat = apply_filters( 'get_the_terms', $prod_cat, $id, $taxonomy );
}
if (!empty($prod_cat))
{
$trail_array = '';
$parent_cats = array();
foreach ($prod_cat as $cat) {
if(!empty($cat->parent))
{
if (!in_array($cat->parent, $parent_cats, false)) $parent_cats[] = (int) $cat->parent;
}
else
{
if (!in_array(0, $parent_cats, false)) $parent_cats[] = (int) 0;
}
}
$i = 0;
foreach ($parent_cats as $parent_cat) {
foreach ($prod_cat as $cat) {
if ( !empty($cat->name) && isset($cat->parent) && $cat->parent == $parent_cat )
{
if ( $i == 0 )
{
$trail_array .= 'slug, $taxonomy ) .'">' . $cat->name . ',';
}
else
{
$trail_array .= ' <span class="sep">' . $separator . '</span> ' . 'slug, $taxonomy ) .'">' . $cat->name . ',';
}
}
}
$trail_array = (substr($trail_array,-1) == ',') ? substr($trail_array, 0, -1) : $trail_array;
$i++;
}
$trail[] = $trail_array;
}
}
--------------------------
Can anyone help please?














