Example #1
0
 public function __construct()
 {
     $widget_ops = array('description' => __("Your links"));
     parent::__construct('links', __('Links'), $widget_ops);
 }
Example #2
0
/**
 * Register all of the default WordPress widgets on startup.
 *
 * Calls 'widgets_init' action after all of the WordPress widgets have been
 * registered.
 *
 * @since 2.2.0
 */
function wp_widgets_init()
{
    if (!is_blog_installed()) {
        return;
    }
    $widget_ops = array('classname' => 'widget_pages', 'description' => __("Your blog's WordPress Pages"));
    wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $widget_ops);
    wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control');
    $widget_ops = array('classname' => 'widget_calendar', 'description' => __("A calendar of your blog's posts"));
    wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $widget_ops);
    wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control');
    $widget_ops = array('classname' => 'widget_archive', 'description' => __("A monthly archive of your blog's posts"));
    wp_register_sidebar_widget('archives', __('Archives'), 'wp_widget_archives', $widget_ops);
    wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control');
    $widget_ops = array('description' => __("Your blogroll"));
    $wp_widget_links = new WP_Widget_Links('links', __('Links'), $widget_ops);
    $wp_widget_links->register();
    $widget_ops = array('classname' => 'widget_meta', 'description' => __("Log in/out, admin, feed and WordPress links"));
    wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $widget_ops);
    wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control');
    $widget_ops = array('classname' => 'widget_search', 'description' => __("A search form for your blog"));
    wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $widget_ops);
    $widget_ops = array('classname' => 'widget_recent_entries', 'description' => __("The most recent posts on your blog"));
    wp_register_sidebar_widget('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries', $widget_ops);
    wp_register_widget_control('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries_control');
    $widget_ops = array('classname' => 'widget_tag_cloud', 'description' => __("Your most used tags in cloud format"));
    wp_register_sidebar_widget('tag_cloud', __('Tag Cloud'), 'wp_widget_tag_cloud', $widget_ops);
    wp_register_widget_control('tag_cloud', __('Tag Cloud'), 'wp_widget_tag_cloud_control');
    wp_widget_categories_register();
    wp_widget_text_register();
    wp_widget_rss_register();
    wp_widget_recent_comments_register();
    do_action('widgets_init');
}