Help with Conditional tags and the loop
-
So I am trying to set up a conditional tag that will change a class name on a div that is nested inside my loop.
Right now the way it is set up, my posts only display on two pages, the homepage, and the page that actually has the post (comments, trackback, etc).
What I am trying to achieve is possibly set up a conditional tag that says: “if home, class equals this, else class equals that”
Here is what I currently have:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (in_category('include')) continue; ?> <!-- trying to change the class name post --> <div class="post" id="post-<?php the_ID(); ?>"> <!-- --> <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <div class="meta"> <?php the_time('l, F j, Y') ?> <div class="feedback"> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/comment.gif"> <?php wp_link_pages(); ?> <?php comments_popup_link(__('Post Comment'), __('1 Comment'), __('% Comments')); ?> </div> </div> <div class="storycontent"> <?php the_content(__('(more...)')); ?> </div> </div>
(I have commented out the code I am trying to effect)
Thanks,
James Bruno
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Help with Conditional tags and the loop’ is closed to new replies.