• kmmathis

    (@wereallthieves)


    It looks like V3 has removed the age_gate_logo filter that I had previously been using extensively to modify the age gate logo. Is there any chance of this being added back in? If not, can you recommend a better way for dynamically modifying the logo?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kmmathis

    (@wereallthieves)

    I’ll add the filter I was using below so you can see what I’m looking for

    add_filter('age_gate_logo', 'custom_filter_age_gate_logo', 10, 2);
    function custom_filter_age_gate_logo($logo, $settings) {
    
    	// if a logo is set, return it
    	if($settings) {
    		return $logo;
    	}
    
    	// no logo is set, use logo from customizer
    	$custom_logo = get_theme_mod( 'custom_setting_logo_header', '');
    	if($custom_logo && $custom_logo['url']) {
    		$logo = '<img class="age-gate-logo" src="'.$custom_logo['url'].'" alt="'.get_bloginfo('name').'" />';
    	}
    	return $logo;
    }
    Plugin Author Phil

    (@philsbury)

    Hi @wereallthieves,

    I’m going to add it in as a “legacy” hook, so it should be considered deprecated.

    It’ll be replaced with two additional filters, but they will work slightly differently to the v2 one;

    age_gate/logo/id and age_gate/logo/src, fairly self explanatory I think, but /id you can change the image ID, /src will be the source.

    The alt text by default will be get_bloginfo('name') which I’ve 100% stolen from your hook!

    So from the next update it’ll work as is, but you should look to change your filter in the long term to:

    
    // Logo in this filter is just the src, the ID can be
    // filtered too with age_gate/logo/id
    function custom_filter_age_gate_logo($logo) {
    
    	// if a logo is set, return it
    	if ($logo) {
    		return $logo;
    	}
    
    	// no logo is set, use logo from customizer
    	$custom_logo = get_theme_mod( 'custom_setting_logo_header', '');
    
            if (!empty($custom_logo['url'])) {
                // where you had get_bloginfo as the alt, that will now be the default
    		return $custom_logo['url'];
    	}
    
    	return $logo;
    }
    
    add_filter('age_gate/logo/src', 'custom_filter_age_gate_logo', 10);
    

    Should be released shortly.

    Thanks
    Phil

    Thread Starter kmmathis

    (@wereallthieves)

    Thanks Phil! I’m on 3.0.9 and none of the filters seem to be firing. This goes for the new src and id filters as well as the deprecated age_gate_logo one. Tested with the 2021 theme and no other plugins active.

    Any updates? I’ve tried many things and cant get this filter working.

    I just need to change logo dependant on language. Because we use different site logo per language.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘age_gate_logo filter’ is closed to new replies.