我正在使用 wordpress 和主题。
我想隐藏所有页面和帖子标题。
所以我加了
.page-header {
display:none;
}
到css文件。
它有效。但我不想隐藏主页标题。 如何做到这一点?
最佳答案
WordPress 有一个名为 body_class()
的函数,它根据当前页面(和...)返回一些可以添加到 body 元素的类。
Themes have a template tag for the body tag which will help theme authors to style more effectively with CSS. The Template Tag is called body_class. This function gives the body element different classes and can be added, typically, in the header.php's HTML body tag.
用法
<body <?php body_class(); ?>>
如果您的主题正在使用该功能,您可以按如下方式从选择器中排除主页:
body:not(.home) .page-header { display: none; }
关于css - 隐藏除主页以外的所有页面标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34554693/