WordPress.org

Ready to get started?Download WordPress

Forums

Alternating Widget Styles (4 posts)

  1. ddietz
    Member
    Posted 6 years ago #

    I've been working on this for a few days now, and I need some help. Here is the basic output idea that I am trying to get from my sidebar widgets:

    <div class="sidebar">
    <div class="type1">Search stuff here.</div>
    <div class="type2">Blog roll here.</div>
    <div class="type1">Another widget here.</div>
    </div>

    Note the alternating css classes. I want to alternate the style of each widget between type1 and type2. I have tried this in functions.php:

    'before_widget' => '<div class="type'.$style.'">',

    This works to get either 1 or 2 if I define my var in functions.php. How can I create a loop or logic statement that can change the value of $style after each widget is generated?

    Thanks!

  2. ddietz
    Member
    Posted 6 years ago #

    Still no luck with this. I've started working in widgets.php hoping to find something that works...

    Does anyone know if there is detailed documentation on widgets.php?

  3. moxcar
    Member
    Posted 5 years ago #

    Did you find a solution for this? I'm having the same problem. Thanks, Bob

  4. alanft
    Member
    Posted 5 years ago #

    have you tried the approach i suggested here

    http://wordpress.org/support/topic/229517

Topic Closed

This topic has been closed to new replies.

About this Topic