WordPress.org

Make WordPress Core

Changeset 25236


Ignore:
Timestamp:
09/04/2013 05:46:08 PM (8 years ago)
Author:
nacin
Message:

Fix 'html5' theme support.

  • Merge, rather than replace, on second add.
  • Make current_theme_supports() work when two arguments are passed.
  • Require the second argument to be an array.

Merges [25193] and [25235] to the 3.6 branch.
fixes #24932.

Location:
branches/3.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.6

  • branches/3.6/wp-includes/theme.php

    r24386 r25236  
    12651265            break;
    12661266
     1267        case 'html5' :
     1268            // You can't just pass 'html5', you need to pass an array of types.
     1269            if ( empty( $args[0] ) ) {
     1270                $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
     1271            } elseif ( ! is_array( $args[0] ) ) {
     1272                _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' );
     1273                return false;
     1274            }
     1275
     1276            // Calling 'html5' again merges, rather than overwrites.
     1277            if ( isset( $_wp_theme_features['html5'] ) )
     1278                $args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
     1279            break;
     1280
    12671281        case 'custom-header-uploads' :
    12681282            return add_theme_support( 'custom-header', array( 'uploads' => true ) );
     
    15481562            break;
    15491563
     1564        case 'html5':
    15501565        case 'post-formats':
    15511566            // specific post formats can be registered by passing an array of types to
    15521567            // add_theme_support()
    1553             $post_format = $args[0];
    1554             return in_array( $post_format, $_wp_theme_features[$feature][0] );
     1568
     1569            // Specific areas of HTML5 support *must* be passed via an array to add_theme_support()
     1570
     1571            $type = $args[0];
     1572            return in_array( $type, $_wp_theme_features[$feature][0] );
    15551573            break;
    15561574
Note: See TracChangeset for help on using the changeset viewer.