Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #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

    #733665

    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;
    }
    #733884

    Hi,

    Great, glad you found a solution and thanks for sharing :-)

    Best regards,
    Rikard

    #1076434

    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?

    #1078084

    Hi,
    Sorry for the late reply, my notes have it as the way you have it above. I take it that it’s working for you?

    Best regards,
    Mike

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.