Support » Fixing WordPress » How to NOT display certain categories in post meta data

Viewing 3 replies - 1 through 3 (of 3 total)
  • From my notes, something like this?

    <?php
    //in the loop, display categories that are not cat id 44
    $cats = get_the_category($post->ID);
    //echo "<pre>"; print_r($cats); echo "</pre>";
      if ($cats) {
        foreach($cats as $cat) {
          if ($cat->cat_ID != 44) {
            echo '<p> category ' . '<a href="' . get_category_link( $cat->cat_ID, 'post_tag' ) . '" title="' . sprintf( __( "View all posts in %s" ), $cat->name ) . '" ' . '>' . $cat->cat_name.'</a> has ' . $cat->count . ' post(s). </p> ';
          }
        }
      }
    ?>
    Thread Starter dshayne

    (@dshayne)

    Thank you! So, I would just drop this into my index.php page, for instance, under here:
    <div class=”post-meta post-top-meta”>
    <span class=”top-categories”>

    and then just change the cat id#?

    Debbie

    You likely would replace the use of the_category with that code.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to NOT display certain categories in post meta data’ is closed to new replies.