Revision: 57482
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 29, 2012 05:47 by lashon
Initial Code
add_action('init', 'add_widget_order_class'); function add_widget_order_class() { global $wp_registered_sidebars, $wp_registered_widgets; $sidebars = wp_get_sidebars_widgets(); if (empty($sidebars)) return; foreach ($sidebars as $sidebar_id => $widgets) { if (empty($widgets)) continue; foreach ($widgets as $i => $widget_id) { $order = $i + 1; $wp_registered_widgets[$widget_id]['classname'] .= ' widget-order-' . $order; } } }
Initial URL
http://konstruktors.com/blog/wordpress/3615-add-widget-order-css-class-sidebar/
Initial Description
Here is a simple filter to automatically add a class attribute like widget-order-1 to all widgets within sidebars (from konstruktors.com)
Initial Title
Add the Order of Widgets Within a Sidebar as a CSS Class to All Widgets
Initial Tags
wordpress
Initial Language
PHP