我换了房间style.css
文件如下:
body.page-id-8 {
background: url(\'http://127.0.0.1/wordpressbis/wp-content/image.jpg\') center center fixed;
width: 100%;
height: 100%;
}
但我得到的结果是:我希望图像位于红色包围区的后台。非常感谢。
我换了房间style.css
文件如下:
body.page-id-8 {
background: url(\'http://127.0.0.1/wordpressbis/wp-content/image.jpg\') center center fixed;
width: 100%;
height: 100%;
}
但我得到的结果是:我希望图像位于红色包围区的后台。非常感谢。
要仅在主页上设置图像,可以使用is_home()
中的函数head
您的header.php
像这样归档
if(is_home()){
<style>
.class-name{
background: url(\'http://127.0.0.1/wordpressbis/wp-content/image.jpg\')
center center fixed;
width: 100%;
height: 100%;
}
</style>
}
在里面https://codex.wordpress.org/Child_Themes 这是包含样式的最佳实践。css在子主题中,必须将下面的代码放入函数中。php的子主题,但将“父样式”替换为可以在函数中找到的父主题的参数。父主题的php。我在我的主题文件中找不到它,那里也没有多少代码。使用@import包含父主题样式表的方法不适用于我,放入文件的css不会在任何浏览器的站点上显示自己。function my_theme_enqueue_styles() { $parent_s