WordPress.org

Make WordPress Core

Ticket #27278: 27278.2.diff

File 27278.2.diff, 1.8 KB (added by jond3r, 6 years ago)
  • src/wp-includes/theme.php

     
    13791379 * The init hook may be too late for some features.
    13801380 *
    13811381 * @since 2.9.0
     1382 *
    13821383 * @param string $feature the feature being added
     1384 * @return void|bool False if trying to add html5 support and not passing an array as 2nd argument (empty 2nd arg works but is discouraged)
    13831385 */
    13841386function add_theme_support( $feature ) {
    13851387        global $_wp_theme_features;
     
    13971399
    13981400                case 'html5' :
    13991401                        // You can't just pass 'html5', you need to pass an array of types.
     1402                        // Note: as of 3.9.0 core supports the types 'comment-list', 'comment-form', 'search-form' and 'gallery'
    14001403                        if ( empty( $args[0] ) ) {
    1401                                 $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
     1404                                $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form', 'gallery' ) );
    14021405                        } elseif ( ! is_array( $args[0] ) ) {
    14031406                                _doing_it_wrong( "add_theme_support( 'html5' )", 'You need to pass an array of types.', '3.6.1' );
    14041407                                return false;
  • tests/phpunit/tests/theme/support.php

     
    9090                $this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
    9191                $this->assertTrue( current_theme_supports( 'html5', 'comment-list' ) );
    9292                $this->assertTrue( current_theme_supports( 'html5', 'search-form' ) );
     93                $this->assertTrue( current_theme_supports( 'html5', 'gallery' ) );
    9394                $this->assertFalse( current_theme_supports( 'html5', 'something-else' ) );
    9495        }
    9596