-
AuthorPosts
-
September 12, 2019 at 11:37 pm #1137724
As the topic suggests, I need a different Logo for different websites.
I tried several forum solutions. Also the most promissing didn’t work:add_filter('avf_logo_link','av_change_logo_link'); function av_change_logo_link($link) { if(is_page(19) ) { $link = "http://kriesi.at"; } return $link; } add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(9) ) { $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } return $logo; }
Can you help please?
best
StefanSeptember 13, 2019 at 10:57 am #1137929Hey Stefan,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaSeptember 13, 2019 at 10:12 pm #1138209Thanks Victoria,
this is just a draft yet.
thanks and regards
StefanSeptember 13, 2019 at 11:10 pm #1138226the last one should work – but as i can read your topic the right way you look also for a solution to change the logo for a whole tree.
So to speak for page-id-9 f.e and all subpages.this here is to define the tree function:
function is_tree($pid) { global $post; $ancestors = get_post_ancestors($post->$pid); $root = count($ancestors) - 1; $parent = $ancestors[$root]; if(is_page() && (is_page($pid) || $post->post_parent == $pid || in_array($pid, $ancestors))){ return true; } else { return false; } };
after that you can change logo for page and subpages.
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo){ if (is_tree(515)) { $logo = "[logo url]";} elseif (is_tree(509)) { $logo = "[logo url]";} elseif (is_tree(530)) { $logo = "[logo url]";} return $logo; }
change that:
[logo url]
the whole expression with your link to your logo url (including brackets)September 13, 2019 at 11:15 pm #1138227but if you like you can do it manually too over an array ( if the amount of pages isn’t so big)
you can use all conditonal tags you know – the tree solution is above – for categories there ar is_category, in_category or has_category etc. pp)add_filter('avf_logo','av_change_logo'); function av_change_logo($logo){ if( is_page(21) ) { $logo = "http://www.domain.com/wp-content/uploads/logoforpage21.jpg"; } elseif ( is_page( array( 42, 54, 6 ) ) ) { $logo = "http://www.domain.com/wp-content/uploads/logoforpage22.jpg"; } elseif ( is_page() && !is_page(1307) ) { $logo = "http://www.domain.com/wp-content/uploads/logoforpage23.jpg"; } return $logo; }
September 16, 2019 at 12:24 pm #1138787Thanks Guenni :-)
I tried to get it to run that way. As the 1st solution didn’t work for me the second did!
Thanks a bunch, Problem solved!September 16, 2019 at 8:52 pm #1138919Hi beenee,
Glad you got it working for you with Guenni007’s help! :)
If you need further assistance please let us know.
Best regards,
VictoriaSeptember 24, 2019 at 12:48 pm #1141367Ticket can be closed. txs!
September 24, 2019 at 5:24 pm #1141461Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Different Logo for different websites (subpages)’ is closed to new replies.