Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1464231

    i want to conditionally use add_filter if html_header_transparency class exists.
    for a snippet in child-theme functions.php

    #1464329

    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

    • This reply was modified 1 month, 1 week ago by Mike.
    #1464460

    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.

    #1464502

    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

    #1464512

    Yes – thanks Ismael – I didn’t realise that Mike’s hint already contained the solution.

    #1464579

    Hi,

    Great! Glad to know you figured it out. Please feel free to open another thread if you have more questions about the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘add_filter only if class exists on html tag’ is closed to new replies.