gpt4 book ai didi

css - 隐藏除主页以外的所有页面标题

转载 作者:行者123 更新时间:2023-11-28 06:37:21 27 4
gpt4 key购买 nike

我正在使用 wordpress 和主题。
我想隐藏所有页面和帖子标题。所以我加了

.page-header {
display:none;
}

到css文件。

它有效。但我不想隐藏主页标题。如何做到这一点?

最佳答案

WordPress 有一个名为 body_class() 的函数,它根据当前页面(和...)返回一些可以添加到 body 元素的类。

Function Reference/body class

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com