WordPress.org

Ready to get started?Download WordPress

Forums

'the_category' with a parameter exclude (4 posts)

  1. n0id
    Member
    Posted 8 years ago #

    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 ?

  2. Tijmen
    Member
    Posted 8 years ago #

    I was looking for the exact same thing. Anyone know if it's possible?

  3. Tijmen
    Member
    Posted 8 years ago #

    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> ';
    }
    }
    ?>

  4. planb247
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags