根据Codex页面关于添加Custom Logo, 必须将以下代码添加到functions.php:
function themename_custom_logo_setup() {
$defaults = array(
\'height\' => 100,
\'width\' => 400,
\'flex-height\' => true,
\'flex-width\' => true,
\'header-text\' => array( \'site-title\', \'site-description\' ),
);
add_theme_support( \'custom-logo\', $defaults );
}
add_action( \'after_setup_theme\', \'themename_custom_logo_setup\' );
我不太确定
height 和
width 已使用。文档中说这是“预期大小”,但当我在customizer中选择要用作s a徽标的图像时,它保留了原始图像大小。
How are these values used? 它们是否以与内置相同的方式定义自定义图像大小名称thumbnail, medium, large, 等等如果是这样,它的名称是什么,以及在使用the_custom_logo() 作用
我试图实现的是以最大图像高度显示自定义徽标,比方说100px, 并且让宽度按比例缩放,而不会扭曲图片,即使加载到定制器中的图像的大小更大。
我真的不知道该怎么做。
添加max-height 之后样式表中的CSS值没有帮助,因为the_custom_logo() 函数显式设置height 和width 中的值<img /> 标签