I'm building a really simple site and I came into this question now. The site has a few content types and one of them acts as a moderated wiki (only users with a certain role may create/edit that content). When viewing lists of these nodes or when viewing any node of that content type in full-mode I would like the site logo to be different. Say, instead of «My site», something like «My site [[wiki]]».
My first thought was tweaking context to change theme settings based on context. Too bad, I didnt find how to get that :/
I've been diving in the available answers here, but I dont seem to have an answer, though a couple of similar question tackle this subject through different systems:
- One attempts to show different logo for different languages and relies and i18n and variable modules. see thread on i18n and variable
- Second one adds a variable (though it is not clear if they put it directly in the node--type.tpl file (and i wouldnt like that :-/), by hand-writing the path to the desired image... see thread on tpl "abusing" :D
Any ideas on what is the best approach to get this custom logo for an specific content type?
Thanks :)
The code provided in the answer wasn't working properly, but I adapted the code and got it to work:
function YOURTHEMENAME_preprocess_page(&$vars, $hook) {
if (isset($vars['node'])) {
// If the node type is "blog" the template suggestion will be "page--node--blog.tpl.php".
$vars['theme_hook_suggestions'][] = 'page__node__' . str_replace('_', '--', $vars['node']->type);
}
}
With this function I got a tweakable and customized page.tpl.php. Now I only need to change the $logo value for this content type or add extra settings to the theme, as hard-coding the url path for the alternative logo seems inelegant :)