Forums

[resolved] How to hide post title and date based on category. (2 posts)

  1. bethdean
    Member
    Posted 2 years ago #

    Hi,
    I'm not that familiar with PHP, but basically what I want to do is hide my post title and date/metadata if it's in my asides category (category number is 9). Here's the code from my template:

    <div class="post" id="post-<?php the_ID(); ?>">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <p id="date"><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></p>
    
    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>
    <p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','',' <strong>|</strong>'); ?> <span class="metadatacomments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span></p>
    </div>

    I know there's an in_category tag, I didn't know if there was something like is not category. Any help would be most appreciated!

  2. Chris_K
    Administrator
    Posted 2 years ago #

    [yes, this is a link to my own site]

    Have a look at the sample code here.

    Does that help?

Topic Closed

This topic has been closed to new replies.

About this Topic