Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1495370
    #1495386

    Hey Tilman,
    If you want a different logo on some pages, try this function in your child theme functions.php and change the logo url to yours and change the page IDs to yours and add as many as you like with a comma between each:

    add_filter('avf_logo','av_change_logo');
    function av_change_logo($logo)
    {
        if(is_page( array(626, 632) ) )
        {
        $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png";
        }
    
        return $logo;
    }

    If you want all pages except your home page to be different, then I would recommend changing your logo in the theme settings to your other logo and use this function to only change the home page to the red one:

    add_filter('avf_logo','av_change_logo');
    function av_change_logo($logo)
    {
        if(is_page(2) )
        {	
        $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png";
        }
        return $logo;
    }

    Best regards,
    Mike

    #1495428

    in your case i would create a is_tree conditional and then change the logo for all subpages by that conditional

    function is_tree($pid) {
        global $post;
        if ( is_page() ) {
            if ( is_page($pid) ) {
                return true;
            }
            $ancestors = get_post_ancestors($post->ID);
            if ( in_array($pid, $ancestors) ) {
                return true;
            }
        }
        return false;
    }
    
    function av_change_logo($logo){
            if (is_tree(265)) { $logo = "[logo url]";} 
        elseif (is_tree(509)) { $logo = "[logo url]";}
        elseif (is_tree(530)) { $logo = "[logo url]";}
    return $logo;
    }
    add_filter('avf_logo','av_change_logo');
    

    your Landschaftbau is page ID: 265

    by the way enfold has now a class on subpages for that on body tag: parent-pageid-265 – but this will only work for the next level of direct children.
    then you can have that conditional:

    if ( is_page(265) || $post->post_parent == 265 ) {
        // ...
    }

    But: the is_tree seems to be more elegant.

    #1495433

    Dear Mike & Guenni,
    thx a lot for your infos. If this was not clear, sorry: I want to have a defined set of different page IDs which are triggering a different logo color. So we are not talking about the home page only:
    -> page ID 1,2,3 -> logo red
    -> page ID 4,5,6 -> logo green

    In addition:
    -> would it be possible to change in a similar way the color of top navigation items as well – and if so, how?
    Same logic with same page IDs as trigger

    thx again & best regards Tilman

    #1495434

    Dear Mike & Guenni,
    thx a lot for your infos. pls see specification below. Cheers, Tilman

    #1495436

    yes – enter your red logo to the enfold logo input field.

    on media library determine the path to your : ETH_galabau_Logo
    guess it looks like this one :

    insert that url to the is_tree(265) url:

    place this snippet to your child-theme functions.php:

    function is_tree($pid) {
        global $post;
        if ( is_page() ) {
            if ( is_page($pid) ) {
                return true;
            }
            $ancestors = get_post_ancestors($post->ID);
            if ( in_array($pid, $ancestors) ) {
                return true;
            }
        }
        return false;
    }
    
    function av_change_logo($logo){
            if (is_tree(265)) { $logo = "/wp-content/uploads/…/…/your_green_galabau_Logo.png";} 
    return $logo;
    }
    add_filter('avf_logo','av_change_logo');

    the first function (function is_tree($pid) ) is for having all subpages to your galabau page (which has the id: 265.
    from this moment – you do not need to add a new page-id to your page_array. If a page is a child of that 265 it will have that green logo.

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