我目前正在努力提高我的主题开发技能,在php方面还有很多需要学习的地方。
我正在调查Underscores
和Twenty Seventeen
主题。我只是不明白为什么下面的代码可以工作,以及它隐藏了什么Site Title
和Tagline
, 如果Display Site Title and Tagline
未选中Customizer中的复选框。
在里面custom-header.php
, 使用默认文本颜色设置自定义标题后#000000
, 主题为标题样式设置函数:
function underscores_header_style() {
$header_text_color = get_header_textcolor();
/*
* If no custom options for text are set, let\'s bail.
* get_header_textcolor() options: Any hex value, \'blank\' to hide text. Default: add_theme_support( \'custom-header\' ).
*/
if ( get_theme_support( \'custom-header\', \'default-text-color\' ) === $header_text_color ) {
return;
}
// If we get this far, we have custom styles. Let\'s do this.
?>
<style type="text/css">
如果我现在将标题文本的颜色设置为#000000
在Customizer中,在我看来if
条款应为真return;
应该结束功能,以下隐藏和超越的整个造型部分不应该工作。到目前为止,我已经与var_dump()
对于get_header_textcolor()
和get_theme_support(\'custom-header\', \'default-text-color\')
. 这两个值都是000000
.
与我的上述考虑相反:一切正常。
我不想在我的主题中“复制-粘贴”这个问题,我想理解它。我的思维错误在哪里?