Hooks for the widgets api. Props ptahdunbar. fixes #12546
git-svn-id: https://develop.svn.wordpress.org/trunk@14382 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9eabb51000
commit
1796f678ff
|
@ -559,6 +559,8 @@ function register_sidebar($args = array()) {
|
|||
|
||||
add_theme_support('widgets');
|
||||
|
||||
do_action( 'register_sidebar', $sidebar );
|
||||
|
||||
return $sidebar['id'];
|
||||
}
|
||||
|
||||
|
@ -629,8 +631,10 @@ function wp_register_sidebar_widget($id, $name, $output_callback, $options = arr
|
|||
);
|
||||
$widget = array_merge($widget, $options);
|
||||
|
||||
if ( is_callable($output_callback) && ( !isset($wp_registered_widgets[$id]) || did_action( 'widgets_init' ) ) )
|
||||
if ( is_callable($output_callback) && ( !isset($wp_registered_widgets[$id]) || did_action( 'widgets_init' ) ) ) {
|
||||
do_action( 'wp_register_sidebar_widget', $widget );
|
||||
$wp_registered_widgets[$id] = $widget;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -685,6 +689,8 @@ function wp_sidebar_description( $id ) {
|
|||
* @param int|string $id Widget ID.
|
||||
*/
|
||||
function wp_unregister_sidebar_widget($id) {
|
||||
do_action( 'wp_unregister_sidebar_widget', $id );
|
||||
|
||||
wp_register_sidebar_widget($id, '', '');
|
||||
wp_unregister_widget_control($id);
|
||||
}
|
||||
|
@ -879,6 +885,8 @@ function dynamic_sidebar($index = 1) {
|
|||
|
||||
$callback = $wp_registered_widgets[$id]['callback'];
|
||||
|
||||
do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] );
|
||||
|
||||
if ( is_callable($callback) ) {
|
||||
call_user_func_array($callback, $params);
|
||||
$did_one = true;
|
||||
|
@ -1193,6 +1201,8 @@ function the_widget($widget, $instance = array(), $args = array()) {
|
|||
$args = wp_parse_args($args, $default_args);
|
||||
$instance = wp_parse_args($instance);
|
||||
|
||||
do_action( 'the_widget', $widget, $instance, $args );
|
||||
|
||||
$widget_obj->_set(-1);
|
||||
$widget_obj->widget($args, $instance);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue