Languages: English • Italiano • 日本語 (Add your language)
Registers a widget.
<?php register_widget( $widget_class ) ?>
None.
class MyNewWidget extends WP_Widget { function __construct() { // Instantiate the parent object parent::__construct( false, 'My New Widget Title' ); } function widget( $args, $instance ) { // Widget output } function update( $new_instance, $old_instance ) { // Save widget options } function form( $instance ) { // Output admin widget options form } } function myplugin_register_widgets() { register_widget( 'MyNewWidget' ); } add_action( 'widgets_init', 'myplugin_register_widgets' );
register_widget() is located in wp-includes/widgets.php
.
Widgets: is_active_widget(), the_widget(), register_widget(), unregister_widget(), wp_register_widget_control(), wp_unregister_widget_control(), wp_convert_widget_settings(), wp_get_widget_defaults(), wp_widget_description()