I am looking for a way not to show the site logo in my homepage (but on all other pages). I can manage to do this only in the nasty way, using css and display none – however, I would like to avoid that the logo is not loaded on the homepage? functions.php?
best, Aprilia
I had a quick look at the site-branding template part which handles the rendering of the custom logo on the site header. There’s a conditional check on two lines against has_custom_logo()
, along show title theme mod, which determines, if the custom logo should be rendered or not.
Internally has_custom_logo()
calls get_theme_mod( 'custom_logo' )
to figure out, if a custom logo has been set. This means, you can use the theme_mod_{$name} filter to change 1) the value of the theme mod and 2) the result of has_custom_logo()
.
As code the above would be something like this,
function prefix_disable_logo_on_front_page( $value ) {
return is_front_page() ? false : $value;
}
add_filter('theme_mod_custom_logo', 'prefix_disable_logo_on_front_page');