Duplicate Parent Category in Post Meta
-
Okay so this theme didn’t originally have categories in the post meta and I finally added them, but then parents weren’t showing and I finally added them. Then however when I have multiple children I get the parent more than once: example. And I am officially over my head… is there any way to make it exempt duplicates? Or something? The code used is below:
<span class="cat"><?php $categories = the_category(' & ', 'multiple'); $seperator = ' & '; $output = ''; $parents = 'multiple'; if($categories){ foreach($categories as $category) { $output .= '<a href="'.get_category_link($category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$seperator; } echo trim($output, $seperator); } ?></span>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Duplicate Parent Category in Post Meta’ is closed to new replies.