Alternate Post styles (not pages)
-
Hello all-
I design my themes starting with the classic template since it’s not inundated with code and CSS I may not use, and then I usually add to it as needed. One problem I am facing however, is that I would like to have 3 posts total on the homepage — each one with different styling/positioning.
Right now I have modified the index file’s post div so that I could target the first post. That has worked, but it does nothing for the other 2 posts (obviously). I could target their specific post IDs but they’d eventually get pushed off the page with each new post added.
In some themes you can target individual posts with stuff like:
body.home #content .p2 {style}
but this isn’t an option in the classic theme.
So my question is, how can I add a function that allows me to style individual posts? I’m fine with doing away with the current addition to the base-code which looks like this:
<?php $firstClass = 'firstpost'; ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" class="post <?php echo $firstClass; ?>"><?php $firstClass = ""; ?>
Thanks so much!
~Deirdre
- The topic ‘Alternate Post styles (not pages)’ is closed to new replies.