register_widget_control

Registers widget control callback for customizing options.

Description

register_widget_control( (string) $name, (callable) $control_callback, (string) $width = '', (string) $height = '' ); 

Allows $name to be an array that accepts either three elements to grab the first element and the third for the name or just uses the first element of the array for the name.

Passes to wp_register_widget_control() after the argument list has been compiled.

Parameters (4)

0. $name (string)
Sidebar ID.
1. $control_callback (callable)
Widget control callback to display and process form.
2. $width — Optional. (string) => ''
Widget width.
3. $height — Optional. (string) => ''
Widget height.

Usage

  1. if ( !function_exists( 'register_widget_control' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Sidebar ID. 
  5. $name = ''; 
  6.  
  7. // Widget control callback to display and process form. 
  8. $control_callback = null; 
  9.  
  10. // Widget width. 
  11. $width = ''; 
  12.  
  13. // Widget height. 
  14. $height = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = register_widget_control($name, $control_callback, $width, $height); 
  18.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function register_widget_control($name, $control_callback, $width = '', $height = '') { 
  2. _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); 
  3. // Compat 
  4. if ( is_array($name) ) { 
  5. if ( count($name) == 3 ) 
  6. $name = sprintf($name[0], $name[2]); 
  7. else 
  8. $name = $name[0]; 
  9.  
  10. $id = sanitize_title($name); 
  11. $options = array(); 
  12. if ( !empty($width) ) 
  13. $options['width'] = $width; 
  14. if ( !empty($height) ) 
  15. $options['height'] = $height; 
  16. $params = array_slice(func_get_args(), 4); 
  17. $args = array($id, $name, $control_callback, $options); 
  18. if ( !empty($params) ) 
  19. $args = array_merge($args, $params); 
  20.  
  21. call_user_func_array('wp_register_widget_control', $args);