/ Published in: PHP

This code goes into the index.php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php while (have_posts()) : the_post(); ?> <!-- EVEN IF YOU'VE GOT PAGEST OF POSTS AFTER THE HOMEPAGE, ONLY THE FIRST POST ON THE FIRST PAGE WILL BE STYLED DIFFERENTLY --> <?php if (is_paged()) : ?> <?php $postclass = ('regular'); ?> <?php else : ?> <?php $postclass = ($post == $posts[0]) ? 'featured' : 'regular'; ?> <?php endif; ?> <!-- NOW THAT WE'VE SET UP THE CONDITIONS, LETS CREATE A DIV WITH THE CSS CLASS FED DYNAMICALLY --> <div class="<?php echo $postclass; ?>"> <!-- THIS IS WHERE ALL THE SCRIPT FOR YOUR POST GOES --> <?php comments_template() ?> <?php endwhile ?>
Comments
