如何降低WordPress Twenty Seventeen主题中的标题图像高度



WordPress Twenty Seventeen主题带有整页标题图像。我想将标题图像的大小减小到更典型的标题大小,仅填充屏幕的一部分并消除视差效果。

在 Twenty Seventeen 主题的功能文件中,您可以修改标题宽度/高度,它定义为下面提到的函数。

add_image_size( 'twentyseventeen-featured-image', 2000, 1200, true );

对于上述功能,您还必须在CSS中调整高度,也可以像以下示例一样调整高度。

.has-header-image.twentyseventeen-front-page .custom-header, .has-header-video.twentyseventeen-front-page .custom-header, .has-header-image.home.blog .custom-header, .has-header-video.home.blog .custom-header{height: 75vh !important;} 

在高度中添加 !important,或者在这里您也可以更改标题的高度。

  1. 通过转到主题>自定义>媒体来删除标题图像。
  2. 通过在"自定义>其他 CSS 的主题"中插入以下代码来添加标题背景图像>:

  #masthead {
    background-image: url(“<insert url of your image>”);
    background-size: 100%;
  }

最新更新