i want to conditionally use add_filter if html_header_transparency class exists.
for a snippet in child-theme functions.php
Hey Guenter,
To me it looks like the html_header_transparency class is added when the $header[‘header_transparency’] is used in the theme settings, so to check for this and trigger a add_filter this works in my test:
function mod_avia_header_setting($header){
if($header['header_transparency'] ){
add_filter( 'yourFilter', 'yourFilter', 10, 2 );
}
return $header;
}
add_filter('avf_header_setting_filter','mod_avia_header_setting');
Best regards,
Mike
what i’m trying to do:
all my transparency pages do have dark backgrounds behind the header area. So my “normal” Logo does not realy have a good contrast to the sticky header after header scrolled.
i like to set on all pages with transparency a different “normal” Logo.
Hi,
This seems to work:
function avf_mod_avia_header_setting($header)
{
if ($header['header_transparency']) {
add_filter('avf_logo', 'avf_mod_logo');
}
return $header;
}
add_filter('avf_header_setting_filter', 'avf_mod_avia_header_setting');
function avf_mod_logo($logo)
{
$logo = "https://kriesi.at/themes/enfold-business-flat/wp-content/uploads/sites/43/2014/08/logo_flat_portfolio.png";
return $logo;
}
Best regards,
Ismael
Yes – thanks Ismael – I didn’t realise that Mike’s hint already contained the solution.