Advertisements

add_custom_image_header

Definition:
function add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback = '' ) {}

Add callbacks for image header display.
The parameter $header_callback callback will be required to display the content for the ‘wp_head’ action. The parameter $admin_header_callback callback will be added to Custom_Image_Header class and that will be added to the ‘admin_menu’ action.

Parameters

  • callback $header_callback: Call on ‘wp_head’ action.
  • callback $admin_header_callback: Call on custom header administration screen.
  • callback $admin_image_div_callback: Output a custom header image div on the custom header administration screen. Optional.

Source code

function add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback = '' ) {

	if ( ! empty( $header_callback ) )

		add_action('wp_head', $header_callback);



	$support = array( 'callback' => $header_callback );

	$theme_support = get_theme_support( 'custom-header' );

	if ( ! empty( $theme_support ) && is_array( $theme_support[ 0 ] ) )

		$support = array_merge( $theme_support[ 0 ], $support );

	add_theme_support( 'custom-header',  $support );

	add_theme_support( 'custom-header-uploads' );



	if ( ! is_admin() )

		return;



	global $custom_image_header;



	require_once( ABSPATH . 'wp-admin/custom-header.php' );

	$custom_image_header = new Custom_Image_Header( $admin_header_callback, $admin_image_div_callback );

	add_action( 'admin_menu', array( &$custom_image_header, 'init' ) );

}

225

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: