Support » How-To and Troubleshooting » Trouble displaying post's categories excluding one

Trouble displaying post's categories excluding one

  • This is my code:

    <div class="byline">
    if ( in_category('1') ) {
    	_e("Show:<?php wp_list_categories('orderby=name&exclude=1,183,192,13'); ?>");
        echo apply_atomic_shortcode( 'byline_tags', '<div class="byline">' . __( '[entry-terms taxonomy="post_tag" before="Host(s): "]', 'ascetica' ) . '</div>' );
    } elseif ( in_category('183') ) {
    	_e("Genre(s):<?php wp_list_categories('orderby=name&exclude=1,183,192,13'); ?>");
    } elseif ( in_category('192') ) {
    	_e("Game Type:<?php wp_list_categories('orderby=name&exclude=1,183,192,13'); ?>");
    } elseif ( in_category('13') ) {
    	_e("Movie Category: <?php foreach((get_the_category()) as $cat) {
      if (!($cat->cat_name=='movie-reviews')) echo $cat->cat_name . ' ';
    } ?>");
    } else {
     _e("Filed under:<?php wp_list_categories('orderby=name&exclude=1,183,192,13'); ?>");

    It’s a bit muddled since I’ve been trying different methods.
    What I’m trying to do: Depending on which category php displays a different label for the categories, then list the categories the post is in excluding parent categories.

    A different approach instead of using if and ifelse is to make a post template for every type of post and list my labels differently in each one. But first I want to figure out displaying categories properly.

    What’s wrong with my code?


  • The topic ‘Trouble displaying post's categories excluding one’ is closed to new replies.