assign class or id to post images
-
Sorry if this question has already been asked, but i have been searching everywhere and cant find an answer.
I want to assign all the images in my posts a certain id or class so i can style them separately to the other images in my theme. How can i acheive this? Is there a template tag to add to the loop?
Heres my current loop.
Cheers.
<div id="content"> <!-- Start Loop --> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <!-- Adds "altpost" Class to Alternate Post --> <?php if ($alt) { $alt = ""; } else { $alt = "altpostspan"; } ?> <div class="postspan <?php echo $alt; ?>"> <div id="post"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php the_content(); ?> </div> </div> </div> <!-- End Loop --> <?php endwhile; ?> <?php endif; ?> </div>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘assign class or id to post images’ is closed to new replies.