| [ Index ] |
PHP Cross Reference of Wordpress 2.9.1 |
[Source view] [Print] [Project Stats]
API for creating dynamic sidebar without hardcoding functionality into themes. Includes both internal WordPress routines and theme use routines. This functionality was found in a plugin before WordPress 2.2 release which included it in the core from that point on.
| File Size: | 1310 lines (40 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
WP_Widget:: (18 methods):
widget()
update()
form()
WP_Widget()
__construct()
get_field_name()
get_field_id()
_register()
_set()
_get_display_callback()
_get_update_callback()
_get_form_callback()
display_callback()
update_callback()
form_callback()
_register_one()
save_settings()
get_settings()
WP_Widget_Factory:: (31 methods):
WP_Widget_Factory()
register()
unregister()
_register_widgets()
register_widget()
unregister_widget()
register_sidebars()
register_sidebar()
unregister_sidebar()
wp_register_sidebar_widget()
wp_widget_description()
wp_sidebar_description()
wp_unregister_sidebar_widget()
wp_register_widget_control()
_register_widget_update_callback()
_register_widget_form_callback()
wp_unregister_widget_control()
dynamic_sidebar()
is_active_widget()
is_dynamic_sidebar()
is_active_sidebar()
wp_get_sidebars_widgets()
wp_set_sidebars_widgets()
wp_get_widget_defaults()
wp_convert_widget_settings()
register_sidebar_widget()
unregister_sidebar_widget()
register_widget_control()
unregister_widget_control()
the_widget()
_get_widget_id_base()
| widget($args, $instance) X-Ref |
| No description |
| update($new_instance, $old_instance) X-Ref |
| No description |
| form($instance) X-Ref |
| No description |
| WP_Widget( $id_base = false, $name, $widget_options = array() X-Ref |
| PHP4 constructor |
| __construct( $id_base = false, $name, $widget_options = array() X-Ref |
| PHP5 constructor param: string $id_base Optional Base ID for the widget, lower case, param: string $name Name for the widget displayed on the configuration page. param: array $widget_options Optional Passed to wp_register_sidebar_widget() param: array $control_options Optional Passed to wp_register_widget_control() |
| get_field_name($field_name) X-Ref |
| Constructs name attributes for use in form() fields This function should be used in form() methods to create name attributes for fields to be saved by update() param: string $field_name Field name return: string Name attribute for $field_name |
| get_field_id($field_name) X-Ref |
| Constructs id attributes for use in form() fields This function should be used in form() methods to create id attributes for fields to be saved by update() param: string $field_name Field name return: string ID attribute for $field_name |
| _register() X-Ref |
| No description |
| _set($number) X-Ref |
| No description |
| _get_display_callback() X-Ref |
| No description |
| _get_update_callback() X-Ref |
| No description |
| _get_form_callback() X-Ref |
| No description |
| display_callback( $args, $widget_args = 1 ) X-Ref |
| No description |
| update_callback( $widget_args = 1 ) X-Ref |
| No description |
| form_callback( $widget_args = 1 ) X-Ref |
| No description |
| _register_one($number = -1) X-Ref |
| No description |
| save_settings($settings) X-Ref |
| No description |
| get_settings() X-Ref |
| No description |
Class: WP_Widget_Factory - X-Ref
Singleton that registers and instantiates WP_Widget classes.| WP_Widget_Factory() X-Ref |
| No description |
| register($widget_class) X-Ref |
| No description |
| unregister($widget_class) X-Ref |
| No description |
| _register_widgets() X-Ref |
| No description |
| register_widget($widget_class) X-Ref |
| Register a widget Registers a WP_Widget widget param: string $widget_class The name of a class that extends WP_Widget |
| unregister_widget($widget_class) X-Ref |
| Unregister a widget Unregisters a WP_Widget widget. Useful for unregistering default widgets. Run within a function hooked to the widgets_init action. param: string $widget_class The name of a class that extends WP_Widget |
| register_sidebars($number = 1, $args = array() X-Ref |
| Creates multiple sidebars. If you wanted to quickly create multiple sidebars for a theme or internally. This function will allow you to do so. If you don't pass the 'name' and/or 'id' in $args, then they will be built for you. The default for the name is "Sidebar #", with '#' being replaced with the number the sidebar is currently when greater than one. If first sidebar, the name will be just "Sidebar". The default for id is "sidebar-" followed by the number the sidebar creation is currently at. param: int $number Number of sidebars to create. param: string|array $args Builds Sidebar based off of 'name' and 'id' values. |
| register_sidebar($args = array() X-Ref |
| Builds the definition for a single sidebar and returns the ID. The $args parameter takes either a string or an array with 'name' and 'id' contained in either usage. It will be noted that the values will be applied to all sidebars, so if creating more than one, it will be advised to allow for WordPress to create the defaults for you. Example for string would be <code>'name=whatever;id=whatever1'</code> and for the array it would be <code>array( 'name' => 'whatever', 'id' => 'whatever1')</code>. name - The name of the sidebar, which presumably the title which will be displayed. id - The unique identifier by which the sidebar will be called by. before_widget - The content that will prepended to the widgets when they are displayed. after_widget - The content that will be appended to the widgets when they are displayed. before_title - The content that will be prepended to the title when displayed. after_title - the content that will be appended to the title when displayed. <em>Content</em> is assumed to be HTML and should be formatted as such, but doesn't have to be. param: string|array $args Builds Sidebar based off of 'name' and 'id' values return: string The sidebar id that was added. |
| unregister_sidebar( $name ) X-Ref |
| Removes a sidebar from the list. param: string $name The ID of the sidebar when it was added. |
| wp_register_sidebar_widget($id, $name, $output_callback, $options = array() X-Ref |
| Register widget for use in sidebars. The default widget option is 'classname' that can be override. The function can also be used to unregister widgets when $output_callback parameter is an empty string. param: int|string $id Widget ID. param: string $name Widget display title. param: callback $output_callback Run when widget is called. param: array|string Optional. $options Widget Options. param: mixed $params,... Widget parameters to add to widget. return: null Will return if $output_callback is empty after removing widget. |
| wp_widget_description( $id ) X-Ref |
| Retrieve description for widget. When registering widgets, the options can also include 'description' that describes the widget for display on the widget administration panel or in the theme. param: int|string $id Widget ID. return: string Widget description, if available. Null on failure to retrieve description. |
| wp_sidebar_description( $id ) X-Ref |
| Retrieve description for a sidebar. When registering sidebars a 'description' parameter can be included that describes the sidebar for display on the widget administration panel. param: int|string $id sidebar ID. return: string Sidebar description, if available. Null on failure to retrieve description. |
| wp_unregister_sidebar_widget($id) X-Ref |
| Remove widget from sidebar. param: int|string $id Widget ID. |
| wp_register_widget_control($id, $name, $control_callback, $options = array() X-Ref |
| Registers widget control callback for customizing options. The options contains the 'height', 'width', and 'id_base' keys. The 'height' option is never used. The 'width' option is the width of the fully expanded control form, but try hard to use the default width. The 'id_base' is for multi-widgets (widgets which allow multiple instances such as the text widget), an id_base must be provided. The widget id will end up looking like {$id_base}-{$unique_number}. param: int|string $id Sidebar ID. param: string $name Sidebar display name. param: callback $control_callback Run when sidebar is displayed. param: array|string $options Optional. Widget options. See above long description. param: mixed $params,... Optional. Additional parameters to add to widget. |
| _register_widget_update_callback($id_base, $update_callback, $options = array() X-Ref |
| No description |
| _register_widget_form_callback($id, $name, $form_callback, $options = array() X-Ref |
| No description |
| wp_unregister_widget_control($id) X-Ref |
| Remove control callback for widget. param: int|string $id Widget ID. |
| dynamic_sidebar($index = 1) X-Ref |
| Display dynamic sidebar. By default it displays the default sidebar or 'sidebar-1'. The 'sidebar-1' is not named by the theme, the actual name is '1', but 'sidebar-' is added to the registered sidebars for the name. If you named your sidebar 'after-post', then the parameter $index will still be 'after-post', but the lookup will be for 'sidebar-after-post'. It is confusing for the $index parameter, but just know that it should just work. When you register the sidebar in the theme, you will use the same name for this function or "Pay no heed to the man behind the curtain." Just accept it as an oddity of WordPress sidebar register and display. param: int|string $index Optional, default is 1. Name or ID of dynamic sidebar. return: bool True, if widget sidebar was found and called. False if not found or not called. |
| is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) X-Ref |
| Whether widget is displayied on the front-end. Either $callback or $id_base can be used $id_base is the first argument when extending WP_Widget class Without the optional $widget_id parameter, returns the ID of the first sidebar in which the first instance of the widget with the given callback or $id_base is found. With the $widget_id parameter, returns the ID of the sidebar where the widget with that callback/$id_base AND that ID is found. NOTE: $widget_id and $id_base are the same for single widgets. To be effective this function has to run after widgets have initialized, at action 'init' or later. param: callback Optional, Widget callback to check. param: int $widget_id Optional, but needed for checking. Widget ID. param: string $id_base Optional, the base ID of a widget created by extending WP_Widget. param: bool $skip_inactive Optional, whether to check in 'wp_inactive_widgets'. return: mixed false if widget is not active or id of sidebar in which the widget is active. |
| is_dynamic_sidebar() X-Ref |
| Whether the dynamic sidebar is enabled and used by theme. return: bool True, if using widgets. False, if not using widgets. |
| is_active_sidebar( $index ) X-Ref |
| Whether a sidebar is in use. param: mixed $index, sidebar name, id or number to check. return: bool true if the sidebar is in use, false otherwise. |
| wp_get_sidebars_widgets($deprecated = true) X-Ref |
| Retrieve full list of sidebars and their widgets. Will upgrade sidebar widget list, if needed. Will also save updated list, if needed. param: bool $update Optional, deprecated. return: array Upgraded list of widgets to version 3 array format when called from the admin. |
| wp_set_sidebars_widgets( $sidebars_widgets ) X-Ref |
| Set the sidebar widget option to update sidebars. param: array $sidebars_widgets Sidebar widgets and their settings. |
| wp_get_widget_defaults() X-Ref |
| Retrieve default registered sidebars list. return: array |
| wp_convert_widget_settings($base_name, $option_name, $settings) X-Ref |
| Convert the widget settings from single to multi-widget format. return: array |
| register_sidebar_widget($name, $output_callback, $classname = '') X-Ref |
| Register widget for sidebar with backwards compatibility. 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 {@link wp_register_sidebar_widget()} after argument list and backwards compatibility is complete. param: string|int $name Widget ID. param: callback $output_callback Run when widget is called. param: string $classname Classname widget option. param: mixed $params,... Widget parameters. |
| unregister_sidebar_widget($id) X-Ref |
| Alias of {@link wp_unregister_sidebar_widget()}. param: int|string $id Widget ID. |
| register_widget_control($name, $control_callback, $width = '', $height = '') X-Ref |
| Registers widget control callback for customizing options. 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 {@link wp_register_widget_control()} after the argument list has been compiled. param: int|string $name Sidebar ID. param: callback $control_callback Widget control callback to display and process form. param: int $width Widget width. param: int $height Widget height. |
| unregister_widget_control($id) X-Ref |
| Alias of {@link wp_unregister_widget_control()}. param: int|string $id Widget ID. |
| the_widget($widget, $instance = array() X-Ref |
| Output an arbitrary widget as a template tag param: string $widget the widget's PHP class name (see default-widgets.php) param: array $instance the widget's instance settings param: array $args the widget's sidebar args return: void |
| _get_widget_id_base($id) X-Ref |
| Private |
| Generated: Fri Jan 8 00:19:48 2010 | Cross-referenced by PHPXref 0.7 |