• Resolved laulaulau

    (@laulaulau)


    I have two category titles (Featured and Headline) I want to hide on my index page. I don’t want the actual post to be hidden though.

    There was a previous resolved thread about this topic with the code but it only worked for one category. I couldn’t edit the code to include more than one category.

    Here’s the code I’m using on my index page.

    <?php
    foreach((get_the_category()) as $category) {
        if ($category->cat_name != 'Featured') {
        echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
    }
    }
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to hide multiple category listing in a post?’ is closed to new replies.