Ticket #22080: 22080.2.diff
File 22080.2.diff, 2.0 KB (added by , 9 years ago) |
---|
-
src/wp-includes/theme.php
1535 1535 $args = array_slice( func_get_args(), 1 ); 1536 1536 1537 1537 switch ( $feature ) { 1538 case 'post-thumbnails': 1539 // Support has already been added for all post types and has a boolean value of true 1540 if ( true === get_theme_support( 'post-thumbnails' ) ) { 1541 return; 1542 } 1543 1544 // Get previously added post types and merge unique values into new array as args 1545 if ( is_array( $args[0] ) && is_array( $_wp_theme_features['post-thumbnails'][0] ) ) { 1546 $values = array_unique( array_merge( $args[0], $_wp_theme_features['post-thumbnails'][0] ) ); 1547 $args = array( $values ); 1548 } 1549 1550 break; 1551 1538 1552 case 'post-formats' : 1539 1553 if ( is_array( $args[0] ) ) { 1540 1554 $post_formats = get_post_format_slugs(); -
tests/phpunit/tests/theme/support.php
52 52 $this->assertFalse( current_theme_supports( 'post-thumbnails' ) ); 53 53 } 54 54 55 /** 56 * @ticket 22080 57 */ 58 public function test_post_thumbnails_mixed_args() { 59 add_theme_support( 'post-thumbnails', array( 'post', 'page' ) ); 60 add_theme_support( 'post-thumbnails', array( 'page' ) ); 61 $this->assertTrue( current_theme_support( 'post-thumbnails', 'post' ) ); 62 $this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) ); 63 $this->assertEquals( 64 array( 0 => array( 'post', 'page' ) ), 65 get_theme_support( 'post-thumbnails' ) 66 ); 67 add_theme_support( 'post-thumbnails' ); 68 $this->assertTrue( current_theme_supports( 'post-thumbnails', 'book' ) ); 69 } 70 55 71 public function test_post_thumbnails_types_true() { 56 72 // array of arguments, with the key of 'types' holding the post types. 57 73 add_theme_support( 'post-thumbnails', array( 'types' => true ) );