Tagged: header, logo, transparent
-
AuthorPosts
-
April 10, 2018 at 3:43 pm #939910
Hello. I have a transparent logo specified (Enfold > Header > Transparency Options). I want to use a different logo on only the home page.
I’ve added the following to functions.php, but it’s not overriding the logo specified above. I’ve also tried swapping out the page ID for “home”. Admin credentials provided.
add_filter(‘avf_logo’,’av_change_logo’);
function av_change_logo($logo)
{
if(is_page(15))
{
$logo = “http://adamwolfpt.pcscloudsolutions.com/wp-content/uploads/adam-wolf-pt-logo-color-transparent.png”;
}
return $logo;
}Thanks!
April 10, 2018 at 4:21 pm #939926Try this instead:
add_filter('avf_header_setting_filter','avf_header_setting_filter_mod'); function avf_header_setting_filter_mod($header) { if( is_home( ) ){ $header['header_replacement_logo'] = "http://adamwolfpt.pcscloudsolutions.com/wp-content/uploads/adam-wolf-pt-logo-color-transparent.png"; } return $header; }
by the way if you have a post as landing page it must be is_frontpage
and the function name is free in use – sometimes a bit more meaningfull is better
add_filter('avf_header_setting_filter','replace_transparent_logo_on_homepage_only'); function replace_transparent_logo_on_homepage_only($header) { if( is_home( ) ){ $header['header_replacement_logo'] = "http://adamwolfpt.pcscloudsolutions.com/wp-content/uploads/adam-wolf-pt-logo-color-transparent.png"; } return $header; }
- This reply was modified 6 years, 8 months ago by Guenni007.
April 10, 2018 at 4:34 pm #939929Thank you for chiming in. Unfortunately, that changes the transparent header on all pages.
April 10, 2018 at 4:42 pm #939933take please your is_page(15) this works definitly
or i dont know why:
add_filter('avf_header_setting_filter','replace_transparent_logo_on_homepage_only'); function replace_transparent_logo_on_homepage_only($header) { if( is_front_page( ) ){ $header['header_replacement_logo'] = "http://adamwolfpt.pcscloudsolutions.com/wp-content/uploads/adam-wolf-pt-logo-color-transparent.png"; } return $header; }
normaly is_home( ) should work if the front-page is a page ! you can see it in your source code that the startpage gets the home class ???
April 10, 2018 at 4:44 pm #939934Good to go! Appreciate ya ‘007. ; )
April 10, 2018 at 5:18 pm #939945by the way avf_header_setting_filter can be used to give one page a unique header style:
Nice things f.e. for a portfolio page to have that design
add_filter('avf_header_setting_filter','av_change_header_style'); function av_change_header_style($header){ if( is_front_page() ){ $header['header_position'] = "header_right header_sidebar"; } return $header; }
April 11, 2018 at 10:05 am #940350 -
AuthorPosts
- You must be logged in to reply to this topic.