-
AuthorPosts
-
January 14, 2017 at 6:50 pm #733604
Hi Guys,
You have a nice function here – https://kriesi.at/support/topic/change-logo-per-page/ – for using a different logo on individual pages.
Is there a way of doing this – url stem for example – for page hierarchies?
e.g. http://www.mysite.com/section1 and anything below it (www.mysite.com/section1/page1 etc) uses one logo and http://www.mysite.com/section2 and anything below it (www.mysite.com/section2/page1 etc) uses another?
Basically we want to use colors to differentiate sections so need different logo images for them.
Many thanks. M
January 14, 2017 at 10:36 pm #733665Sharing solution – works for me:
function is_tree($pid) { // $pid = The ID of the page we're looking for pages underneath global $post; // load details about this page if(is_page()&&($post->post_parent==$pid||is_page($pid))) return true; // we're at the page or at a sub page else return false; // we're elsewhere }; add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_tree(20) ) { $logo = "http://www.mysite.dev/wp-content/uploads/logo1.png"; } elseif(is_tree(30) ) { $logo = "http://www.mysite.dev/wp-content/uploads/logo2.png"; } elseif(is_tree(40) ) { $logo = "http://www.mysite.dev/wp-content/uploads/logo3.png"; } return $logo; }January 16, 2017 at 5:53 am #733884Hi,
Great, glad you found a solution and thanks for sharing :-)
Best regards,
RikardMarch 8, 2019 at 6:15 pm #1076434So, if I have 4 sections I need to create 4 unction is_tree($pid) and stuff, or should I only add the page numbers?
March 13, 2019 at 4:31 am #1078084 -
AuthorPosts
- You must be logged in to reply to this topic.
