WordPress.org

Support

Support » How-To and Troubleshooting » How to: switch between CSS classes?

How to: switch between CSS classes?

  • thealchemyst
    Member

    @thealchemyst

    I’m still a WP newbie and I have this issue: I want to list my posts in two columns. Both are using CSS class (“list-story” and “list-story-alt”) so is there some WP tag where I could just switch dynamically those CSS classes?

    This is how I want to present:

    <div class="list-story">
    Story info
    </div>
    
    <div class="list-story-alt">
    Story info
    </div>
    
    <div class="list-story">
    Story info
    </div>
    
    ...

    Any tips?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You need to alter more than the css to list your posts in columns. Try a forum search to see how others accomplished it:

    http://wordpress.org/search/posts+columns?forums=1

    thealchemyst
    Member

    @thealchemyst

    I thought there is a simple method for it. For example in ExpressionEngine there is a “switch” method where you can basically do this:

    <div class=”{switch=’list-story|list-story-alt’}”></div>

    And you get alternate DIVs.

    Can WordPress accomplish it with this kind of manner or it needs some deeper hacks?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to: switch between CSS classes?’ is closed to new replies.