Is there a way to show a different main logo in the header (top left) when browsing threads within a certain category or their sub categories? Thank you.
I believe the body includes a class category-{category here}, which you could use to change category specific CSS.
I don’t know how to execute a script after the page content have loaded (I’m interested to know that too!), but for changing the logo image, you could do this:
// in a condition like if category == "somecategory" then…
document.getElementById("#site-logo").src = settings.theme_uploads.logo_cat1;
where logo_cat1 is the variable name of a custom logo:

我也遇到了同样的问题。我知道这是一个老话题了,但如果有人看到,这里有一个解决方案。
您可以使用 CSS 并利用 body 元素上的类来检测您所属的类别。
// 不显示常规网站徽标
body.category-something #site-logo {
display: none;
}
// 在标题中显示另一张图片
body.category-something .home-logo-wrapper-outlet {
height: 50px;
width: 100px;
background-image: url($category-something-image);
}
希望这有道理 ![]()
我认为您需要将图像放在 <a> 元素上,否则徽标链接将失效。
// 在标题中显示另一个图像
body.category-something .d-header .title a {
...
}
啊,对了,我之前主要关注的是 CSS 选择器。谢谢你的纠正。
1 个赞