a conditional statement for the post id?
-
Hi,
I have my most recent posts listed in my sidebar and am trying to figure out dynamic menu highlighting for the post when selected. My sidebar code looks like this:
<h2>WORK</h2>
<?php query_posts(‘category=work&showposts=15’); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?><div id=”post-<?php the_ID(); ?>”>
<h3>“><?php the_title(); ?></h3>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</div>I would like to put a conditional tag on the h3 tag of my post so that if we are viewing the post is becomes <h3 class=”current”>. I imagine it would be something like <h3 <?php if…class=\”current\””>> but I can’t figure out the conditional tag. I feel it may be a problem because the actual post it in another loop. Has anyone any experience with something like this?
Thank you for any help, it is very much appreciated.
Nick
The topic ‘a conditional statement for the post id?’ is closed to new replies.