<?php /** * Add numerious for each widget in sidebar */ function htmlandcms_widget_classes($params) { static $classes; if (!isset($classes[$params[0]['id']])) { $classes[$params[0]['id']] = 1; } else { $classes[$params[0]['id']] += 1; } $params[0]['before_widget'] = "<div id='{$params[0]['id']}-{$classes[$params[0]['id']]}'>" . $params[0]['before_widget']; $params[0]['after_widget'] = $params[0]['after_widget'] . "</div>"; return $params; } add_filter('dynamic_sidebar_params', 'htmlandcms_widget_classes');