-
AuthorPosts
-
June 26, 2018 at 10:37 pm #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,
AramJune 27, 2018 at 6:15 am #978248Hey 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,
MikeJune 27, 2018 at 8:41 am #978295Hi 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
June 27, 2018 at 11:23 am #978359Hi,
Thanks for the login, please include ftp access in the Private Content area so we can try adding the code to the functions.phpBest regards,
MikeJune 27, 2018 at 11:25 am #978360Hi Mike, here is the FTP information.
June 27, 2018 at 11:38 am #978363Hi 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.pngAram
- This reply was modified 6 years, 5 months ago by steenvreter.
June 27, 2018 at 11:58 am #978370hello Mike.
I have adjusted the alternative logo file in the media library. New link is below
June 28, 2018 at 3:50 am #978684Hi,
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,
MikeJune 28, 2018 at 2:51 pm #978902Mike, 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
June 28, 2018 at 4:14 pm #978938 -
AuthorPosts
- The topic ‘Different logo for specific pages needed’ is closed to new replies.