get_custom_header_markup

函式
get_custom_header_markup ( No parameters )
返回值
  • (string) The markup for a custom header on success.
定義位置
相關方法
the_custom_header_markupget_custom_headerget_compat_media_markupget_random_header_imagehas_custom_header
引入
4.7.0
棄用
-

get_custom_header_markup: 這個函式返回當前主題的自定義頁首的HTML標記。它可以用來在網站的前端顯示頁首。

檢索自定義頁首的標記。

容器div將總是在自定義器的預覽中被返回。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_custom_header_markup() {
if ( ! has_custom_header() && ! is_customize_preview() ) {
return '';
}
return sprintf(
'<div id="wp-custom-header" class="wp-custom-header">%s</div>',
get_header_image_tag()
);
}
function get_custom_header_markup() { if ( ! has_custom_header() && ! is_customize_preview() ) { return ''; } return sprintf( '<div id="wp-custom-header" class="wp-custom-header">%s</div>', get_header_image_tag() ); }
function get_custom_header_markup() {
	if ( ! has_custom_header() && ! is_customize_preview() ) {
		return '';
	}

	return sprintf(
		'<div id="wp-custom-header" class="wp-custom-header">%s</div>',
		get_header_image_tag()
	);
}

常見問題

FAQs
檢視更多 >