Echo category path without main (parent category)
-
Hey, Greg,
Maybe You could help me with some line of code. I want to remove main(parent) category from the line.
<span title="<?php echo esc_attr( get_the_title() ) ?>" class="advert-link"> <span class="advert-link-text"> <?php $advert_category = get_the_terms( $post_id, 'advert_category' ) ?> <?php if(!empty($advert_category)): ?> <?php foreach($advert_category as $c): ?> <a href="<?php echo esc_attr( get_term_link( $c ) ) ?>"><?php echo join( " / ", advert_category_path( $c ) ) ?></a> <?php endforeach; ?> <?php endif; ?> </span>
So this basically will represent add title as category path like this:
Main category / subcategory / subcategoryAll i need is the add title would look like this:
subcategory / subcategoryAny ideas?
Thank’s in advance!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Echo category path without main (parent category)’ is closed to new replies.