Reputation: 37464
I have this loop:
<?php while (have_posts()) : the_post(); ?>
<li><h2 class="titles"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2></li>
<li><span class="post-date">Posted <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></span><span class="post-cat">Filed under: <?php the_category(', ') ?> by <?php the_author(); ?></span></li>
<li><p><?php the_excerpt(); ?></p></li>
<div class="voting"><?php DisplayVotes(get_the_ID()); ?></div>
<?php endwhile;?>
I only want to put this line <div class="voting"><?php DisplayVotes(get_the_ID()); ?></div>
in only if the loop is referencing a certain category, ie. if (category== 'birthdays') then output this line.
I know how to do an if statement but what condition do i put in?
Upvotes: 0
Views: 3577
Reputation: 557
You can create custom theme for each category, Just call it "category-ID.php" and edit it as you want. Check out this link http://codex.wordpress.org/Category_Templates
Upvotes: 1
Reputation: 16835
Use get_the_category function
global $post;
$categories = get_the_category($post->ID);
var_dump($categories);
Upvotes: 3