Alternating Widget Styles (4 posts)

  1. ddietz
    Posted 8 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>

    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?


  2. ddietz
    Posted 8 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
    Posted 7 years ago #

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

  4. alanft
    Posted 7 years ago #

    have you tried the approach i suggested here


Topic Closed

This topic has been closed to new replies.

About this Topic