Could someone explain to me what "classname" in the $widget_ops array means when you're creating a custom widget? It doesn't seem to have any relevance. I've searched both the source and the db and can't find any instance of it.

$widget_ops = array( 'classname' => 'example', 'description' => 'widget description ' );

$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' );

$this->WP_Widget( 'example-widget', 'Example Widget', $widget_ops, $control_ops );

It is simply the css class of the widget.

Take a look here : http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/widgets.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.