Custom_Image_Header::reset_header_image()

最后更新于:2021-11-25 19:47:44

Custom_Image_Header::reset_header_image()

Reset a header image to the default image for the theme.

源文件

文件: gc-admin/includes/class-custom-image-header.php

	final public function reset_header_image() {
		$this->process_default_headers();
		$default = get_theme_support( 'custom-header', 'default-image' );

		if ( ! $default ) {
			$this->remove_header_image();
			return;
		}

		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );

		$default_data = array();
		foreach ( $this->default_headers as $header => $details ) {
			if ( $details['url'] === $default ) {
				$default_data = $details;
				break;
			}
		}

		set_theme_mod( 'header_image', $default );
		set_theme_mod( 'header_image_data', (object) $default_data );
	}