Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Last active December 28, 2015 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovshenin/7465664 to your computer and use it in GitHub Desktop.
Save kovshenin/7465664 to your computer and use it in GitHub Desktop.
<?php
if ( ! isset( $_GET['test-remove-theme-supports'] ) )
return;
// Use ?test-remove-theme-supports=1 or 2 or 3
switch ( $_GET['test-remove-theme-supports'] ) {
case 1:
define( 'HEADER_IMAGE_WIDTH', 123 );
add_theme_support( 'custom-header' );
if ( 123 != get_theme_support( 'custom-header', 'width' ) )
die( 'something went wrong, was not able to set width.' );
if ( defined( 'HEADER_IMAGE_HEIGHT' ) )
die( 'something went wrong, why was height defined?' );
// just-in-time
do_action( 'wp_loaded' );
if ( ! defined( 'HEADER_IMAGE_HEIGHT' ) )
die( 'something went wrong, height should be defined by now.' );
break;
case 2:
add_theme_support( 'custom-header', array( 'width' => 456 ) );
if ( 456 != get_theme_support( 'custom-header', 'width' ) )
die( 'was not able to set width to 456.' );
define( 'HEADER_IMAGE_WIDTH', 123 );
add_theme_support( 'custom-header', array( 'width' => 789 ) );
if ( 456 != get_theme_support( 'custom-header', 'width' ) )
die( 'was not able to keep width at 456.' );
// just-in-time
do_action( 'wp_loaded' );
if ( 456 != get_theme_support( 'custom-header', 'width' ) )
die( 'was not able to set keep width at 456.' );
if ( ! defined( 'HEADER_IMAGE_HEIGHT' ) )
die( 'something went wrong, height should be defined by now.' );
break;
case 3:
define( 'HEADER_IMAGE_WIDTH', 123 );
add_theme_support( 'custom-header' );
define( 'HEADER_IMAGE_HEIGHT', 456 );
add_theme_support( 'custom-header' );
if ( 123 != get_theme_support( 'custom-header', 'width' ) )
die( 'Could not set width to 123' );
if ( 456 != get_theme_support( 'custom-header', 'height' ) )
die( 'Could not set height to 456' );
break;
}
die( 'everything looks ok' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment