WordPress.org

Make WordPress Core

Ticket #22905: 22905.diff

File 22905.diff, 3.5 KB (added by jeremyfelt, 5 years ago)

Refresh of PHPDoc for register_sidebar

  • wp-includes/widgets.php

     
    509509/**
    510510 * Builds the definition for a single sidebar and returns the ID.
    511511 *
    512  * The $args parameter takes either a string or an array with 'name' and 'id'
    513  * contained in either usage. It will be noted that the values will be applied
    514  * to all sidebars, so if creating more than one, it will be advised to allow
    515  * for WordPress to create the defaults for you.
     512 * Accepts either a string or an array and then parses that against a set
     513 * of default arguments for the new sidebar. WordPress will automatically
     514 * generate a sidebar ID and name based on the current number of registered
     515 * sidebars if those arguments are not included.
    516516 *
    517  * Example for string would be <code>'name=whatever;id=whatever1'</code> and for
    518  * the array it would be <code>array(
    519  *    'name' => 'whatever',
    520  *    'id' => 'whatever1')</code>.
     517 * When allowing for automatic generation of the name and ID parameters, keep
     518 * in mind that the incrementor for your sidebar can change over time depending
     519 * on what other plugins and themes are installed.
    521520 *
    522  * name - The name of the sidebar, which presumably the title which will be
    523  *     displayed.
    524  * id - The unique identifier by which the sidebar will be called by.
    525  * before_widget - The content that will prepended to the widgets when they are
    526  *     displayed.
    527  * after_widget - The content that will be appended to the widgets when they are
    528  *     displayed.
    529  * before_title - The content that will be prepended to the title when displayed.
    530  * after_title - the content that will be appended to the title when displayed.
     521 * If theme support for 'widgets' has not yet been added when this function is
     522 * called, it will be automatically enabled through the use of add_theme_support()
    531523 *
    532  * <em>Content</em> is assumed to be HTML and should be formatted as such, but
    533  * doesn't have to be.
     524 * Arguments passed as a string should be separated by '&'
    534525 *
     526 *     i.e. 'name=Sidebar&id=my_prefix_sidbar'
     527 *
     528 * The same argument passed as an array:
     529 *
     530 *     array(
     531 *         'name' => 'Sidebar',
     532 *         'id'   => 'my_prefix_sidebar',
     533 *     )
     534 *
     535 * Arguments:
     536 *     name          - The name or title of the sidebar displayed in the admin dashboard.
     537 *     id            - The unique identifier by which the sidebar will be called.
     538 *     before_widget - HTML content that will prepended to each widget's HTML output
     539 *                     when assigned to this sidebar.
     540 *     after_widget  - HTML content that will be appended to each widget's HTML output
     541 *                     when assigned to this sidebar.
     542 *     before_title  - HTML content that will be prepended to the sidebar title when displayed.
     543 *     after_title   - HTML content that will be appended to the sidebar title when displayed.
     544 *
    535545 * @since 2.2.0
    536546 * @uses $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID.
     547 * @uses add_theme_support() to ensure widget support has been added
    537548 *
    538  * @param string|array $args Builds Sidebar based off of 'name' and 'id' values
    539  * @return string The sidebar id that was added.
     549 * @param string|array $args arguments for the sidebar being registered
     550 * @return string sidebar ID added to the registered sidebars global
    540551 */
    541552function register_sidebar($args = array()) {
    542553        global $wp_registered_sidebars;