Viewing 1 replies (of 1 total)
  • um, isn’t that what breadcrumbs are for?

    get_category just prints out link(s) to the applicable categories. You need to use get_terms to access the taxonomy objects and find the ones with no parent

    $terms = get_the_terms($post->ID,'product_cat');
    
    $count = count($terms); $i=0;
    if ($count > 0) {
        $term_list = '<span class="parent_category">Parent Category:';
        foreach ($terms as $term) {
            $i++;
    if($term->parent==0){
        	$term_list .= '<a href="/product-category/' . $term->slug . '" title="' . sprintf(__('View all post filed under %s', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a>';
        	if ($count != $i) $term_list .= ' &middot; '; }
        }
        echo $term_list .'</span>';
Viewing 1 replies (of 1 total)
  • The topic ‘back to parent category’ is closed to new replies.