Category tags, exclude more than one category?
-
Hi,
I have this beautiful code that prints the list of the categories which the post is assign to. I can exclude one category but now I need to exclude more than one… I try to put it in a array but somehow I don’t know what I’m doing wrong.<div class="cat_tags"> <?php $categories = get_the_category(); $excluded_cat = '1'; $separator = ' / '; $output = ''; if($categories){ foreach($categories as $category) { if ( $category->cat_ID != $excluded_cat ) $output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator; } echo trim($output, $separator); } ?> </div>
Thanks for your help,
Fery
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Category tags, exclude more than one category?’ is closed to new replies.