• I have a widgetized footer and I want to be able to style every third widget in the footer differently. I know I can use :nth-child(3n) in css but that won’t work in older browsers. Currently I’m using jquery to solve this.

    However I am after a non-javascript solution, specifically getting the widgets to output class names based on their position, widget-1, widget-2 etc.

    Is this possible?

Viewing 1 replies (of 1 total)
  • $s = wp_get_sidebars_widgets();
        print_r($s);

    That should give you an array of sidebars and their widgets. I haven’t checked carefully but it looks like the widgets are in order so you should be able to parse that to find you widget positions.

    print_r($args);

    … will tell you which sidebar your widget is in, if you need that.

Viewing 1 replies (of 1 total)
  • The topic ‘Customizing widget class names’ is closed to new replies.