Custom_Image_Header::__construct() WordPress Method

The Custom_Image_Header::__construct() method allows a user to set a custom image as a header for their WordPress site. This is done by providing the URL of the image, the width of the image, and the height of the image. This method can be used in conjunction with the Custom_Image_Header::set_header_image() method to set a custom image as a header for a WordPress site.

Custom_Image_Header::__construct( callable $admin_header_callback, callable $admin_image_div_callback = '' ) #

Constructor – Register administration header callback.


Parameters

$admin_header_callback

(callable)(Required)

$admin_image_div_callback

(callable)(Optional)custom image div output callback.

Default value: ''


Top ↑

Source

File: wp-admin/includes/class-custom-image-header.php

	public function __construct( $admin_header_callback, $admin_image_div_callback = '' ) {
		$this->admin_header_callback    = $admin_header_callback;
		$this->admin_image_div_callback = $admin_image_div_callback;

		add_action( 'admin_menu', array( $this, 'init' ) );

		add_action( 'customize_save_after', array( $this, 'customize_set_last_used' ) );
		add_action( 'wp_ajax_custom-header-crop', array( $this, 'ajax_header_crop' ) );
		add_action( 'wp_ajax_custom-header-add', array( $this, 'ajax_header_add' ) );
		add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove' ) );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.