Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   [SOLVED] Alternating color for post on homepage (http://forum.bytesforall.com/showthread.php?t=2013)

viscouse Jun 11, 2009 02:23 PM

[SOLVED] Alternating color for post on homepage
 
I know there is an option for making every other comment different colors.

I couldn't find a similar option for posts. Does it exist and I missed it?

If not is there a way to impliment that?

Thanks!

viscouse Jun 24, 2009 06:18 PM

Sorry to bump this, but would anyone know how to do this?
Should I make this a feature request?

Flynn Jun 25, 2009 10:35 AM

You can edit index.php

<?php // Post Container starts here
if ( function_exists('post_class') ) { ?>
<div <?php if ( is_page() ) { post_class('post'); } else { post_class(); } ?> id="post-<?php the_ID(); ?>">
<?php } else { ?>
<div class="<?php echo ( is_page() ? 'page ' : '' ) . 'post" id="post-'; the_ID(); ?>">
<?php } ?>


Change to


<?php // Odd or even
$odd_or_even = (($postcount % 2) ? 'odd-post' : 'even-post' ); ?>


<?php // Post Container starts here
if ( function_exists('post_class') ) { ?>
<div <?php if ( is_page() ) { post_class('post'); } else { post_class("$odd_or_even"); } ?> id="post-<?php the_ID(); ?>">
<?php } else { ?>
<div class="<?php echo ( is_page() ? 'page ' : '' ) . 'post" id="post-'; the_ID(); ?>">
<?php } ?>


I included the code above in 3.3.4


Add a CSS Insert:

div.odd-post {
background: ...
border: ...
}

div.even-post {
background: ...
border: ...
}

viscouse Jun 25, 2009 07:08 PM

Thank you Flynn!

I appreciate your responsiveness!


All times are GMT -6. The time now is 04:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.