Title: Loop Through Widget Styles
Last modified: August 19, 2016

---

# Loop Through Widget Styles

 *  [matt987](https://wordpress.org/support/users/matt987/)
 * (@matt987)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/loop-through-widget-styles/)
 * I’m building a theme and what I’m trying to do is for each widget have a custom
   style applied. For example, the sidebar will have three text widgets. I want 
   the title of the first widget to have a background of blue, the next widget title
   will have a background of green, and the third widget title will have a background
   of red, and if any new widgets are added the cycle will start over. I know you
   can accomplish this using a loop, but the widget before_title and after_title
   elements are defined in an array. Any ideas on how to accomplish this?

The topic ‘Loop Through Widget Styles’ is closed to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 0 replies
 * 1 participant
 * Last reply from: [matt987](https://wordpress.org/support/users/matt987/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/loop-through-widget-styles/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
