Genesis Framework-如何更改自定义标题css代码


Genesis Framework - How to change custom header css code?

我使用的是genesis框架,我想在我的子主题中支持头部图像。我想将我上传的图像的位置更改为标题图像。

我在函数中添加了这行代码。hp:

add_theme_support( 'genesis-custom-header', array( 'width' => 213, 'height' => 300) );

Genesis现在为首页中的.site标题生成css代码:

.site-header { background: url(http://localhost:8888/studio/wp-content/uploads/2014/09/my_logo.png) no-repeat !important; }

我想更改此代码,因为我想将一些其他CSS内容应用于我的<header>,如background-positionbackground-size等。我在官方文档中看到,我可以在add_theme_support中使用'header-callback',但它究竟是如何工作的?我必须如何编写我的回调函数,让WP自动更改为.site-header生成的代码?

如果我在style.css文件中更改.site-header,则不会有任何更改。它必须如上所述生成,但是如何生成呢?

谢谢!

用style.CSS编写的CSS应该覆盖默认样式!你确定加价是一样的吗?

您可以尝试使用"!在css值中声明"important"以赋予优先级,例如

.site-header {
    background-size: cover !important;
}

此外,您还可以向自定义头数组添加更多值:

add_theme_support( 'genesis-custom-header', array(
    'default-image' => get_stylesheet_directory_uri() . '/images/logo.png',
    'default-color' => 'efefe9',
    'header_image'    => '',
    'header-selector' => '.site-title a',
    'header-text'     => false,
    'height'          => 115,
    'width'           => 960,
) );

并用设计您的徽标

.site-header .site-title a {
     //your css here
}

请注意,如果你使用的是儿童主题(我认为),这个片段是有效的

希望它能有所帮助;)Francesco