Advertisements

add_custom_background

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

Add callbacks for background image 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_Background 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 background administration screen.
  • callback $admin_image_div_callback: Output a custom background image div on the custom background administration screen. Optional.

Source code

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

	if ( isset( $GLOBALS['custom_background'] ) )

		return;



	if ( empty( $header_callback ) )

		$header_callback = '_custom_background_cb';



	add_action( 'wp_head', $header_callback );



	add_theme_support( 'custom-background', array( 'callback' => $header_callback ) );



	if ( ! is_admin() )

		return;

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

	$GLOBALS['custom_background'] = new Custom_Background( $admin_header_callback, $admin_image_div_callback );

	add_action( 'admin_menu', array( &$GLOBALS['custom_background'], 'init' ) );

}

223

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: