Using Conditional tags
-
Hi all!
I’ve got a slight problem here. Here’s some code I’m working on.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="titles"> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <strong><h3><?php if (is_category('4')){ the_time('Y'); } else { the_time('m.d.Y'); } ?></h3></strong> </div> <div class="storycontent"> <?php the_content(__('(Read More)')); ?> </div> </div> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>
My problem is why isn’t the conditional statement doing its job and displaying only the year when the post is in category 4 or the entire date when its in category 5? Here’s the page I’m working on. The Events tab is category 5 and the Projects tab is category 4.
Thanks so much,
Eric Huang
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using Conditional tags’ is closed to new replies.