-
AuthorPosts
-
March 15, 2024 at 12:00 pm #1437292
Hi Support,
I’m using the avf_logo hook below:
function about_logo_header($logo) { if (is_page('about')) { $logo = 'https://motiveagency.com/wp-content/uploads/2024/03/about.svg'; } return $logo; }
But because I am using the transparent header as well (Sticky Header), only 1 of the logos is being updated, the logo in “subtext avia-svg-logo-sub” is still the old logo.
How do I update that one as well?
Thanks
SeanMarch 17, 2024 at 10:40 am #1437396this sub logo is called header_replacement_logo and could be changed via avf_header_setting_filter:
But: there must be something to replace – means : a transparency logo had to be defined on enfold options – then it could be replaced by a different logo.
on handling svg files just use the ID of that Logo ( look to your media library in list mode). Or look to url window in grid mode
on inserting/replacing png, jpg or gif use the url to replace the standard logo and not the IDfunction av_change_alt_logo_img($header){ if (is_page('about')) { $header['header_replacement_logo'] = 44238; } return $header; } add_filter('avf_header_setting_filter','av_change_alt_logo_img');
PS: if the named page does not work use the ID of that page (without quotes)
next : if you do not want to declare a transparency options logo on enfold options- then only activate the transparency logo for that page before adding the logo:
function av_change_alt_logo_img($header){ if(is_page('about')) { $header['header_class'] .= ' av_alternate_logo_active'; $header['header_replacement_logo'] = 44238; } return $header; } add_filter('avf_header_setting_filter','av_change_alt_logo_img');
_______________
PPS: this is a good way to replace the logo (standard logo) with an svg file :
function av_change_logo($logo){ if(is_page(123)) { $logo = 456; // ID of the svg Logo } return $logo; } add_filter('avf_logo', 'av_change_logo');
March 18, 2024 at 8:23 am #1437437Just for info: I always recommend reworking the code of Illustrator-generated svg. Illustrator assigns a standard class with a counting index (st0, st1, st2 etc.). Unfortunately, if there are several inline svg on a page, the last svg on the page determines the properties of the class. Just css.
Either you edit the svg in a good text editor, or you define your own graphic styles in Illustrator for the fillings of the graphic elements. The graphic styles are then transferred to the svg code as a class.March 18, 2024 at 8:36 am #1437438Hi @Guenni007
I really appreciate your detailed response. I however tried all of your solutions with no luck:
function av_change_logo($logo){ if(is_page(3597)) { $logo = 3951; // ID of the svg Logo } return $logo; } add_filter('avf_logo', 'av_change_logo'); function av_change_alt_logo_img($header){ if (is_page(3597)) { $header['header_class'] .= ' av_header--about'; $header['header_replacement_logo'] = 3951; } return $header; } add_filter('avf_header_setting_filter','av_change_alt_logo_img');
Still only the first SVG in the “logo avia-svg-logo” was updated, not the logo in “subtext avia-svg-logo-sub”, although not ideal, I have since achieved what I was after using the header_class and CSS:
.av_header--about { .avia-svg-logo-sub { opacity: 0; } svg { opacity: 1 !important; } &:not(.av_header_transparency) { svg { path { fill: #4e4e4e; } } } }
Thanks all the same
SeanMarch 18, 2024 at 8:40 am #1437439Scratch that, I found some other header styles I have which mess with the opacity, so I would imagine my issue relates to that and your code probably works fine.
Thanks again
March 18, 2024 at 9:13 am #1437441try:
(but as mentioned above – if you have defined a standard transparency logo on enfold options – you do not need to add that header_class)function av_change_alt_logo_img($header){ if(is_page(1313)) { $header['header_class'] .= ' av_alternate_logo_active'; $header['header_replacement_logo'] = 3951; } return $header; } add_filter('avf_header_setting_filter','av_change_alt_logo_img');
the header class to activate the transparency logo is set by enfold to: av_alternate_logo_active
the page-id of your about page is : 1313 isn’t it ?
the logo ID – can not proove it from dev tools.March 18, 2024 at 9:23 am #1437442by the way – if your logo svg is well designed – you can change on inline svg fillings with quick css.
because you do not have a shrinking header – you can use for that the header class: av_header_transparencyf.e.:
.av_header_transparency .logo .st0 { fill: #4e4e4e }
and here you can see the benefit of reworking the svg code – that class ( or there might be other path on that page) are allways the same for standard Illustrator setting.
_______________btw: if you got a shrinking header you can use the class on html in combination with the class header-scrolled.
.html_header_transparency #header:not(.header-scrolled) .logo .st0 { fill: #4e4e4e }
March 18, 2024 at 9:35 am #1437443so here is my version of your logo:
https://webers-testseite.de/motive-agency.svgon looking to the svg with dev tools ( or download it and see in a good text editor) you see that i renamed the standard classes st to ma – and even the gradient is build via class – so changing it from outwards css (quick css) is easy even for the gradient stop-colors.
April 10, 2024 at 8:46 pm #1439690sorry one error there is an extra attr for Logo ID: header_replacement_logo_id
so snippet has to be :
function av_change_alt_logo_img($header){ if(is_page(1313)) { $header['header_class'] .= ' av_alternate_logo_active'; $header['header_replacement_logo_id'] = 3951; } return $header; } add_filter('avf_header_setting_filter','av_change_alt_logo_img');
-
AuthorPosts
- You must be logged in to reply to this topic.