描述:
判断当前主题是否设置了头部图像
用法:
<?php has_header_image() ?>
参数:
None.
示例:
<?php if ( has_header_image() ) { ?>
<img src="<?php echo( get_header_image() ); ?>" alt="<?php echo( get_bloginfo( 'title' ) ); ?>" />
<?php } ?>
源文件:
/**
* Check whether a header image is set or not.
*
* @since 4.2.0
*
* @see get_header_image()
*
* @return bool Whether a header image is set or not.
*/
function has_header_image() {
return (bool) get_header_image();
}