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:
I recently had this problem also. I realise this is an old topic, but here’s a solution in case someone comes by.
You can use CSS and utilize the classes on the body
element to detect which category you are in.
// Dont show regular site logo
body.category-something #site-logo {
display: none;
}
// Show another image in the title
body.category-something .home-logo-wrapper-outlet {
height: 50px;
width: 100px;
background-image: url($category-something-image);
}
Hope that makes sense
I think you’d need to put your image on the <a>
element, else the logo link will just collapse.
// Show another image in the title
body.category-something .d-header .title a {
...
}
Ah, right, I was mostly focussing on the CSS selectors. Thanks for correcting that.
1 Like