WordPress.org

Ready to get started?Download WordPress

Forums

twentyten theme post background color (7 posts)

  1. xmatter
    Member
    Posted 3 years ago #

    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?

  2. Peter_L
    Member
    Posted 3 years ago #

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

  3. Tara
    Member
    Posted 3 years ago #

    @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).

  4. alchymyth
    Forum Moderator
    Posted 3 years ago #

    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

  5. Tara
    Member
    Posted 3 years ago #

    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).

  6. alchymyth
    Forum Moderator
    Posted 3 years ago #

    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.

  7. Tara
    Member
    Posted 3 years ago #

    yes, that did it! thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags