The codex doesn't seem to say how one would go about adding a description to a custom widget registered with wp_register_sidebar_widget(). The default description seems to be the name of teh widget itself.

function myFunc(){
  /* widget code */
}
wp_register_sidebar_widget( 'wdgt1', 'Site Map', 'myFunc', array() );

alt text

link|improve this question

68% accept rate
feedback

3 Answers

up vote 4 down vote accepted

Here's what you looking for:

class WP_Widget_Sitemap extends WP_Widget {

    function WP_Widget_Sitemap() {
        $widget_ops = array( 'classname' => 'widget_sitemap', 'description' => __( "This is the description" ) );
        $this->WP_Widget( 'sitemap', __('Site Map'), $widget_ops);
    }

    function widget() { ... }
    function form() { ... }
    function update() { ... }
...

See: http://codex.wordpress.org/Widgets_API#Developing_Widgets

link|improve this answer
feedback

This is the old (and difficult) way to create WordPress widgets. Use the Widget API instead: http://codex.wordpress.org/Widget_API.

link|improve this answer
feedback

it give a param for description in array of the function to register widget:

register_sidebar()

Example can you see on this post or this code.

if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
        'name' => 'My Lorem Ipsum Sidebar',
        'description' => __('Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.', 'your_textdomain'),
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));
}
link|improve this answer
3  
You are adding a new sidebar, I think Jonathan wants to add a new sidebar widget. – Jan Fabry Dec 7 '10 at 10:08
you have right, sorry. the param is also the same. – bueltge Dec 7 '10 at 19:13
feedback

Your Answer

 
or
required, but never shown

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