Adding algorithmic class attribute to widget box
-
I’m working on a theme that has widgets running horizontally across the footer. The theme is styled to have three across.
It would be helpful if I could hack something to put a different class in the first, second, and third widget-wrapping divs. This would allow me to roll back to the beginning if there’s a 4th (or 7th, etc) widget. I’m guessing somewhere I’d need code along the lines of
switch $countOfThisWidget mod 3 { case 1: echo "<div class='firstwidget'>"; case 2: echo "<div class='secondwidget'>"; case 0: echo "<div class='lastwidget'>"; }
Clearly I’d need to hack an existing function; I’d like to do this in a portable way so that I can distribute the theme and not need to worry about hacking on future copies of WP.
If we lived in the magical future of CSS3, I wouldn’t need to bother with this at all.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding algorithmic class attribute to widget box’ is closed to new replies.