Codex tools: Log in
Contents |
Register widget for use in sidebars.
<?php wp_register_sidebar_widget( $id, $name, $output_callback, $options, $params, ... ); ?>
function my_output_callback_function( $args, $params ){ ... }
$args array contains:
The 'dynamic_sidebar_params' filter is applied to the parameters (as an array), before your output function is called back.
The following code will create a widget called "Your Widget" which will become available in the WordPress Administrative Panels. The widget can then be dragged to an available sidebar for display.
<?php
function your_widget_display() {
// print some HTML for the widget to display here
echo "Your Widget Test";
}
wp_register_sidebar_widget(
'your_widget_1', // your unique widget id
'Your Widget', // widget name
'your_widget_display', // callback function
array( // options
'description' => 'Description of what your widget does'
)
);
?>
Since: 2.2.0
wp_register_sidebar_widget() is located in wp-includes/widgets.php.
Sidebars: is_active_sidebar(), register_sidebars(), register_sidebar(), unregister_sidebar(), is_dynamic_sidebar(), dynamic_sidebar(), wp_register_sidebar_widget(), wp_unregister_sidebar_widget(), wp_get_sidebars_widgets(), wp_set_sidebars_widgets()
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()