• n0id

    (@n0id)


    I would love to have a modified template tag ‘the_category’ with a parameter ‘exclude’ as in ‘wp_list_cats’ or ‘list_cats’ to exclude some categories in posts. Is there anyone here who knows if that already exists or who could make a plugin to do so ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I was looking for the exact same thing. Anyone know if it’s possible?

    Worked it out by myself.

    This is the solution (4815162342 for the excluded cat).


    <?php
    foreach((get_the_category()) as $cat) {
    if ($cat->cat_ID != "4815162342") {
    echo '| <a href="?cat=' . $cat->cat_ID . '">' .
    $cat->cat_name . '</a> ';
    }
    }
    ?>

    I’m trying to get something similar to work at Josh and Tamra Show. I want the Main Category (“Episodes”) to show up as a link in the metadata but not the Sub-Categories (“Apt. 413”, “Street”, “Monkey News Source”). Right now it’s showing both Categories.

    thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘‘the_category’ with a parameter exclude’ is closed to new replies.