In new add_theme_support() logic, fix logic inversion, define HEADER_IMAGE in a simpler way, and force args to be an array. see #20249.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8eb703d33a
commit
369fca1509
|
@ -1283,6 +1283,9 @@ function add_theme_support( $feature ) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'custom-header' :
|
case 'custom-header' :
|
||||||
|
if ( ! is_array( $args ) )
|
||||||
|
$args = array( 0 => array() );
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'default-image' => '',
|
'default-image' => '',
|
||||||
'random-default' => false,
|
'random-default' => false,
|
||||||
|
@ -1329,7 +1332,7 @@ function add_theme_support( $feature ) {
|
||||||
|
|
||||||
if ( defined( 'HEADER_IMAGE_HEIGHT' ) )
|
if ( defined( 'HEADER_IMAGE_HEIGHT' ) )
|
||||||
$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
|
$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
|
||||||
elseif ( ! isset( $args[0]['height'] ) )
|
elseif ( isset( $args[0]['height'] ) )
|
||||||
define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
|
define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
|
||||||
|
|
||||||
if ( defined( 'HEADER_TEXTCOLOR' ) )
|
if ( defined( 'HEADER_TEXTCOLOR' ) )
|
||||||
|
@ -1339,13 +1342,12 @@ function add_theme_support( $feature ) {
|
||||||
|
|
||||||
if ( defined( 'HEADER_IMAGE' ) )
|
if ( defined( 'HEADER_IMAGE' ) )
|
||||||
$args[0]['default-image'] = HEADER_IMAGE;
|
$args[0]['default-image'] = HEADER_IMAGE;
|
||||||
|
elseif ( isset( $args[0]['default-image'] ) )
|
||||||
|
define( 'HEADER_IMAGE', $args[0]['default-image'] );
|
||||||
|
|
||||||
if ( $jit && ! empty( $args[0]['default-image'] ) )
|
if ( $jit && ! empty( $args[0]['default-image'] ) )
|
||||||
$args[0]['random-default'] = false;
|
$args[0]['random-default'] = false;
|
||||||
|
|
||||||
if ( ! defined( 'HEADER_IMAGE' ) && ( isset( $args[0]['default-image'] ) || isset( $args[0]['random-default'] ) ) )
|
|
||||||
define( 'HEADER_IMAGE', $args[0]['default-image'] );
|
|
||||||
|
|
||||||
// If headers are supported, and we still don't have a defined width or height,
|
// If headers are supported, and we still don't have a defined width or height,
|
||||||
// we have implicit flex sizes.
|
// we have implicit flex sizes.
|
||||||
if ( $jit ) {
|
if ( $jit ) {
|
||||||
|
@ -1358,6 +1360,9 @@ function add_theme_support( $feature ) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'custom-background' :
|
case 'custom-background' :
|
||||||
|
if ( ! is_array( $args ) )
|
||||||
|
$args = array( 0 => array() );
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'default-image' => '',
|
'default-image' => '',
|
||||||
'default-color' => '',
|
'default-color' => '',
|
||||||
|
|
Loading…
Reference in New Issue