• Resolved alexflaco

    (@alexflaco)


    Is there a way to remove a category in my post metadata?

    <div class="postmetadata">
    
    				<?php the_date(); ?><?php the_category(', ') ?>|
    				<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    
    			</div>

    I removed the category in my category section but I can’t do it in my post metadata.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • does removing this obvious part from you code snippet not work?

    <?php the_category(', ') ?>

    if not, you might be editing the wrong template.

    Thread Starter alexflaco

    (@alexflaco)

    If I remove the code you said I will not show any of the categories from the post. What I need is if the post has more than one category, let say, web and newsletter I will like only to show web.

    I did it in my category section where I show all my categories except category 10 with this code:

    <?php wp_list_categories('show_count=1&title_li=&exclude=10'); ?>

    here I show all my categories and I hide category 10.

    Thanks

    won’t work with <?php the_category(', ') ?>

    you could program something like (where 23 is the category id of the excluded cat):

    <?php $cats = get_the_category();
    if( $cats ) foreach( $cats as $cat ) {
    $sep = '';
      if( $cat->term_id != 23 ) {
      echo $sep . '<a href="' . get_category_link( $cat->term_id ) . '">' . $cat->name . '</a>'; $sep = ', ';
      }
    }
    ?>

    http://codex.wordpress.org/Function_Reference/get_the_category

    Thread Starter alexflaco

    (@alexflaco)

    Perfect.

    Thank you, I love forums they are full of knowledge.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘remove category from postmetadata’ is closed to new replies.