WordPress.org

Support

Support » How-To and Troubleshooting » twentyten theme post background color

twentyten theme post background color

  • xmatter

    @xmatter

    I want to alternate the post bg color but i cannot find info on the net to do this, because none of them address the posts being sectioned into 3 parts. Anyone have a fix for this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Peter_L

    @peter_l

    each post in twenty ten is inside a
    <div id="post-XX" class="...">

    Tara

    @t-p

    Volunteer Moderator

    @xmatter

    http://wordpress.org/support/topic/different-post-colors?replies=29

    there is some relevant info in the above thread, which may be of some help (I tried sometime ago but then gave up – I found it to be over my head).

    Moderator Michael

    @alchymyth

    Forum Moderator

    the posts being sectioned into 3 parts

    the following is only for the ‘third part’ – the ‘normal’ posts:

    edit loop.php of Twenty Ten:

    find:

    <?php /* How to display all other posts */ ?>
    	<?php else : ?>
    		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    change to:

    <?php /* How to display all other posts */ ?>
    	<?php else : ?><?php $stripe = ($stripe == 'dark') ? 'bright' : 'dark'; ?>
    		<div id="post-<?php the_ID(); ?>" <?php post_class($stripe); ?>>

    add this to style.css (with your own color codes):

    .dark { background-color: #FF00FF; }
    .bright { background-color: #66FFCC; }

    http://codex.wordpress.org/Template_Tags/post_class

    Tara

    @t-p

    Volunteer Moderator

    Thanks alchymyth,

    It works great!

    Is it possible to limit the background color to post content area only (i.e, exclude all tags from being colored above the body of the post such as title, date author… and also exclude all tags from being colored below the body of the post such as categories, and so on).

    Moderator Michael

    @alchymyth

    Forum Moderator

    should work with:

    .dark .entry-content { background-color: #FF00FF; }
    .bright .entry-content { background-color: #66FFCC; }

    however, .entry-content is very close to the edge of the words in the posts – just give it a try and see what you think.

    Tara

    @t-p

    Volunteer Moderator

    yes, that did it! thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘twentyten theme post background color’ is closed to new replies.