you can add an extra css class to the post div or post title element (h3 ?);
something along these lines:
example for adding an alternating css class into the h3 tag:
<h3 class="<?php echo (($wp_query->current_post%2 == 0) ? 'red-title' : 'blue-title'); ?>"><?php the_title(); ?></h3>
Thread Starter
Jaelli
(@jaelli)
Thanks, alchymyth. That looks like it should work. I’ve forgotten everything I knew about php and WP….
Thread Starter
Jaelli
(@jaelli)
Just to update: in order to get this to work, I had to add the php alchymyth provided into the <a> tagset
, like this:
<h2 class="entry-title"><a class="<?php echo (($wp_query->current_post%2 == 0) ? 'red-title' : 'blue-title'); ?>" href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
I also had to add and change things in the css of course.
So client will be happy…. next thing of course is that he’ll want the single page title in the red and blue instead of black…. I might have to “just say no” at that point!
At that point I would just say no and explain that it would become an accessibility issue as visitors wouldn’t be able to tell the difference between the colour of a post title and a link to that post.
Thread Starter
Jaelli
(@jaelli)
I believe you’re right Rab, and thanks for that thought.