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
Sharing 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;
}
Hi,
Great, glad you found a solution and thanks for sharing :-)
Best regards,
Rikard
So, if I have 4 sections I need to create 4 unction is_tree($pid) and stuff, or should I only add the page numbers?