Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #978173

    Hello,
    I need to use a different logo for some pages.

    I have found a ticket with a solution from 2013 and that doesn’t work any longer it seems.

    URL is below,

    Thank you,
    Aram

    #978248

    Hey steenvreter,
    As I understand your request, you would like to change the logo for your management page and all child pages of it. Try adding this code to the end of your functions.php file in Appearance > Editor:

    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;
      }
    };
    
    add_filter('avf_logo','av_change_logo');
    function av_change_logo($logo)
    {
        if (is_tree(1406)) 
    {
    	$logo = "https://kriesi.at/themes/enfold-minimal-portfolio/wp-content/uploads/sites/51/2015/07/logo_minimal_portfolio.png";
    }
    
        return $logo;
    }

    I have added the correct page ID “1406” for you, you only need to change the logo image url.
    I tested this on my localhost and it seemed to work correctly.

    Best regards,
    Mike

    #978295

    Hi Mike,

    Unfortunately, your solution gives an error in return “this page isn’t showing:
    I have pasted the code in my child theme > functions.php file (via FTP) and as soon as I load the page, the error is showing.

    I can give you login credentials if you want.

    Aram/Steenvreter

    #978359

    Hi,
    Thanks for the login, please include ftp access in the Private Content area so we can try adding the code to the functions.php

    Best regards,
    Mike

    #978360

    Hi Mike, here is the FTP information.

    #978363

    Hi Mike,
    for the time being, this should be the alternative logo.
    http://preview.rooff.nl/wp-content/uploads/2018/06/rooff_logo_214-grijs.png So all pages get the black log, but pages with ID 1406 and in the tree below that page get the grey logo
    http://preview.rooff.nl/wp-content/uploads/2018/06/rooff_logo_214-grijs.png

    Aram

    • This reply was modified 6 years, 5 months ago by steenvreter.
    #978370

    hello Mike.

    I have adjusted the alternative logo file in the media library. New link is below

    #978684

    Hi,
    I have added the code in your child theme functions.php with your new image url, and it seems to be working good.
    Please clear your browser cache and check.

    Best regards,
    Mike

    #978902

    Mike, you are the best!

    It works perfectly. But why didn’t it work when I tried your code in the same file?
    Anyway, this works and I am happy.

    case closed

    #978938

    Hi,

    Reading above, i am guessing it was cache related.

    Glad Mike could help! Let us know if you have any other questions or issues :)

    Best regards,
    Yigit

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Different logo for specific pages needed’ is closed to new replies.