Tagged: custom menu, Custom Post Type, logo, navigation
-
AuthorPosts
-
December 9, 2014 at 1:55 pm #365316
Hi guys,
So I have a follow up question for my thread here.
When using a custom logo for a custom post type, I added the code you gave me and it works. However, if I try to add more unique pages, the code you mentioned gets me this error:
Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/content/34/11243234/html/wp-content/themes/enfold-child/functions.php on line 63Line 63 is the one bolded below.
add_filter(‘avf_logo’,’new_logo_url’);
function new_logo_url($use_image){
if(is_singular(‘spicypresentations’)||(array(3548,4176,4306,3546)))$use_image = “http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/Spicy-Presentations-by-Lia-Logo.png”;
return $use_image;
}It worked fine when I just had the one custom post type like this: if(is_singular(‘spicypresentations’))$use_image = “http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/Spicy-Presentations-by-Lia-Logo.png”;
But when I tried to add more pages to the if statement, it just won’t work. I’m sure it’s juts a silly syntax error, but I’d really appreciate your help!
Thanks guys!
CamilleDecember 9, 2014 at 7:56 pm #365543Hey camtay!
Please try the code as following
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(3548,4176,4306,3546) ) { $logo = "http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/Spicy-Presentations-by-Lia-Logo.png"; } return $logo; }
Regards,
YigitDecember 9, 2014 at 9:00 pm #365605Hi Yigit,
I inserted the code above but it’s only working for the first page (3548), the others still have the other logo.
Thanks,
CamilleDecember 10, 2014 at 3:51 am #365819Hi!
You need to pass the ids to an array:
is_page( array(3548,4176,4306,3546 ) )
Cheers!
IsmaelDecember 10, 2014 at 8:30 am #365869Just tried that and got this error – Parse error: syntax error, unexpected ‘{‘ in /home/content/34/11243234/html/wp-content/themes/enfold-child/functions.php on line 71
Here’s the code I used, line 71 is bolded (it’s the second ‘{‘):
add_filter(‘avf_logo’,’av_change_logo’);
function av_change_logo($logo)
{
if(is_page(array(3548,4176,4306,3546)))
{
$logo = “http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/Spicy-Presentations-by-Lia-Logo.png”;
}
return $logo;
}December 11, 2014 at 7:14 am #366522Hi!
I tested this on my installation and it works fine.
Please use this:
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(array(17,12))) { $logo = "http://nutsandboltsspeedtraining.com/wp-content/uploads/2014/11/Spicy-Presentations-by-Lia-Logo.png"; } return $logo; }
Replace the ids.
Best regards,
IsmaelDecember 12, 2014 at 9:34 am #367157Hi Ismael,
That worked, thank you so much! And so if I have a logo url redirect after that, how do I add those same page IDs to the custom post? Right now I have this:add_filter(‘avf_logo_link’, ‘avf_redirect_logo_link’);
function avf_redirect_logo_link($link) {
if(is_singular(‘spicypresentations’))
$link = ‘http://www.nutsandboltsspeedtraining.com/spicypresentations/’;
return $link;
}I want to add those 3 pages to this function.
Thanks!
December 13, 2014 at 5:42 pm #367706Hey!
Try to replace the code with this:
add_filter('avf_logo_link', 'avf_redirect_logo_link'); function avf_redirect_logo_link($link) { if(is_singular('spicypresentations') || is_page(array(12,17))) $link = 'http://www.nutsandboltsspeedtraining.com/spicypresentations/'; return $link; }
Regards,
IsmaelDecember 18, 2014 at 9:35 am #369882Perfect, thanks Ismael!!!
-
AuthorPosts
- The topic ‘Different Main Navigation Menu and Logo for Custom Post Type? – Fix?’ is closed to new replies.