Text Widget with different class
-
Question:
My question is how do I get text-1 to use class “note”.Background Story:
I’m using the Artificial Intelligence theme, found at https://ericulous.com/2007/02/09/wp-theme-artificial-ntelligence/.As you notice from AI, there is a yellow box on the end of the sidebar identified with the class “note”. When you choose to use widgets, all the sidebar boxes are with the class “box”. I’ve looked at both the css and widget.php and saw nothing that would allow me choose a different class. However I did notice that in the widget.php there is this line “$id = “text-$i”;” which I figured could help me but what I tried failed. So since my mind is in overload mode, can someone figure out what I need to put down. Thanks in advance!
CSS:
#sidebar li ul li{
list-style-type:none;
margin-left:20px;
}
.box {
padding: 4px 15px;
border: 1px solid #ccc;
margin: 0 0 10px 0;
}.note {
padding: 15px 15px 20px 100px;
border: 1px solid #CFCB66;
margin: 0 0 5px 0;
background: #FFFFAD url(images/package.gif) no-repeat;
color: #585616;
}Widget.php:
wp_widget_text_register() {
$options = get_option(‘widget_text’);
$number = $options[‘number’];
if ( $number < 1 ) $number = 1;
if ( $number > 9 ) $number = 9;
$dims = array(‘width’ => 460, ‘height’ => 350);
$class = array(‘classname’ => ‘widget_text’);
for ($i = 1; $i <= 9; $i++) {
$title = $options[$i][‘title’];
$name = __(‘Text (‘ . $title . ‘)’);
$id = “text-$i”; // Never never never translate an id
wp_register_sidebar_widget($id, $name, $i <= $number ? ‘wp_widget_text’ : /* unregister */ ”, $class, $i);
wp_register_widget_control($id, $name, $i <= $number ? ‘wp_widget_text_control’ : /* unregister */ ”, $dims, $i);
}
add_action(‘sidebar_admin_setup’, ‘wp_widget_text_setup’);
add_action(‘sidebar_admin_page’, ‘wp_widget_text_page’);
}
- The topic ‘Text Widget with different class’ is closed to new replies.