The Loop
<?php if ( have_posts() ) { while ( have_posts() ) { the_post();
<!-- Test if the current post is in category 3. --> <!-- If it is, the div box is given the CSS class "post-cat-three". --> <!-- Otherwise, the div box is given the CSS class "post". --> <?php if ( in_category( '3' ) ) : ?> <div class="post-cat-three"> <?php else : ?> <div class="post"> <?php endif; ?>
<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y'); ?> by <?php the_author_posts_link(); ?></small>
<div class="entry"> <?php the_content(); ?> </div>
<p class="postmetadata"><?php _e( 'Posted in' ); ?> <?php the_category( ', ' ); ?></p> </div> <!-- closes the first div box --> } // end while } // end if ?> See More at - Codex: The Loop