• ddietz

    (@ddietz)


    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!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Alternating Widget Styles’ is closed to new replies.