I've got a routine (see below) that creates and inserts several widgets into the active theme's sidebars.
However, I need more control over either the order/index the are assigned (ie, one of my widgets need to be at the top of any other widgets in the sidebar) OR, I need to be able to specify a custom css name for the widget.
I've inserted a comment to catch the widget titled "my important widget" and apply the index or custom css I'll need to assign to that widget.
Are either of these possible?
$file_name_widget = $files_widgets->getPathname();
$widget_text = file_get_contents($file_name_widget);
$widget_text_label = 'text';
$widget_ops = get_option('widget_text', array());
$widget_id = count($widget_ops) + 1;
if($file_name_widget == 'my important widget') {
//place code here to make this widget move to the top of any others in the sidebar its assigned to
}
$widget_ops[$widget_id] = array('title' => $files_widgets->getBasename('.txt'),'text' => $widget_text,);
update_option('widget_text', $widget_ops);
$sidebar_id = basename($files_widgets->getPath());
$sidebars_widgets = get_option('sidebars_widgets', array());
$sidebars_widgets[$sidebar_id][] = $widget_text_label."-".$widget_id;
update_option('sidebars_widgets', $sideb