WordPress.org

Make WordPress Core

Changeset 13928


Ignore:
Timestamp:
04/02/2010 03:15:18 AM (9 years ago)
Author:
nacin
Message:

Child theme support for theme header registrations. Second call to register_theme_headers() should add more headers, not replace existing headers. add unregister_theme_headers(). props jorbin. see #12343

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r13908 r13928  
    13531353 * @since 3.0.0
    13541354 *
    1355  * @param array $headers Array of headers keyed by a string id.  The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys.
     1355 * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys.
    13561356 */
    13571357function register_default_headers( $headers ) {
    13581358    global $_wp_default_headers;
    13591359
    1360     $_wp_default_headers = $headers;
     1360    $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
     1361}
     1362
     1363/**
     1364 * Unregister default headers.
     1365 *
     1366 * This function must be called after register_default_headers() has already added the
     1367 * header you want to remove.
     1368 *
     1369 * @see register_default_headers()
     1370 * @since 3.0.0
     1371 *
     1372 * @param string|array The header string id (key of array) to remove, or an array thereof.
     1373 * @return True on success, false on failure.
     1374 */
     1375function unregister_default_headers( $header ) {
     1376    global $_wp_default_headers;
     1377    if ( is_array( $header ) ) {
     1378        array_map( 'unregister_default_headers', $header );
     1379    } elseif ( isset( $_wp_default_headers[ $header ] ) ) {
     1380        unset( $_wp_default_headers[ $header ] );
     1381        return true;
     1382    } else {
     1383        return false;
     1384    }
    13611385}
    13621386
Note: See TracChangeset for help on using the changeset viewer.