WordPress.org

Ready to get started?Download WordPress

Forums

How to: switch between CSS classes? (3 posts)

  1. thealchemyst
    Member
    Posted 5 years ago #

    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?

  2. iridiax
    Member
    Posted 5 years ago #

    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

  3. thealchemyst
    Member
    Posted 5 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic