-
AuthorPosts
-
January 13, 2016 at 6:39 pm #564934
Hi Please can you point me to instructions on working with page templates using an Enfold child theme.
I have a parent site and want a separate sub site with different top menu and logo that can be selected from Page Attributes.
So far I have created a page-templates directory in my Enfold child theme with a renamed copy of page.php. The only changes I have made to the php is the <?php /* Template Name: fubar */ ?> tag.
I thought it better to check with you before proceeding.
I followed instructions here:Thanks
RobJanuary 14, 2016 at 2:51 am #565136Hi fanlokbun!
Well if your wanting to change the logo and menu then a template isn’t what your wanting. You would need to add some code into your child theme functions.php file to switch those out.
But you said you want to do this on a “sub site”? Or do you mean just some separate pages in the same installation?
If it’s on a sub site with a different installation of WordPress then a child theme is not necessary.
Best regards,
ElliottJanuary 14, 2016 at 2:12 pm #565391Thanks Elliott,
Sorry yes I mean separate pages in the same installation to have a different top menu and logo. What is the best way to do this?January 14, 2016 at 5:08 pm #565557Hey!
– You can use this plugin to display different menu per page – https://wordpress.org/plugins/zen-menu-logic/
– Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(9) ) { $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } return $logo; }
It would display a different logo on a page with ID of 9
Cheers!
YigitJanuary 15, 2016 at 6:54 pm #566292Thanks Yigit that’s great.
One dumb question I have a lot of pages with different ID’s. Say I had 3 page id’s of 301, 302, 303 would the functions.php be:add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(301, 302, 303) ) { $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } return $logo; }
January 15, 2016 at 8:42 pm #566318One more thing:
Please add following code to Functions.php file in Appearance > Editor
I was just going to try it out but can’t find Appearance > Editor. I have Appearance > Edit CSS but no Functions.php there.
January 19, 2016 at 5:55 pm #567998Hi I have tried adding this to my functions.php in my child theme. (I’m guessing you meant that.)
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(306) ) { $logo = "http://goldhillmuseum.org.uk/wp-content/uploads/2016/01/great-war-header-90x380.png"; } return $logo; }
But no luck. Please help when you can.
Thanks
RobJanuary 19, 2016 at 6:05 pm #568009Hey!
Do you mind creating a temporary admin login and posting it here privately?
To target multiple pages, please change the code to following one
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(is_page(array(301, 302, 303))) { $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } return $logo; }
Regards,
YigitJanuary 19, 2016 at 6:11 pm #568016Thanks Yigit,
Login below.
BTW I had some other code in the functions.php very similar to change the logo on mobile devices. I have commented it out to try and get this code to work but I would prefer if they both did.
January 20, 2016 at 1:20 pm #568588Hi Yigit
I can’t see what you but logo is working fine now with the array. I just need to add 2 more filters1- to change the to the same logo on pages with /story/ in the address as well. (e.g. goldhillmuseum.org.uk/story/305/).
2 – as mentioned I want this one to work too:
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if(wp_is_mobile() ) { $logo = "http://goldhillmuseum.org.uk/wp-content/uploads/2015/06/gold-hill-museum-header-340x156.png"; } return $logo; }
Thanks for all your help
Rob- This reply was modified 8 years, 11 months ago by fanlokbun.
January 22, 2016 at 2:31 am #569688Hi!
1. You can use this conditional:
if(is_singular('story'){ }
2. You can multiple conditionals in the same block:
add_filter('avf_logo','av_change_logo'); function av_change_logo($logo) { if ( wp_is_mobile() ) { $logo = "http://goldhillmuseum.org.uk/wp-content/uploads/2015/06/gold-hill-museum-header-340x156.png"; } elseif( is_page(array(301, 302, 303)) ){ $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } elseif ( is_singular('story') ){ $logo = "http://kriesi.at/wp-content/themes/kriesi/images/logo.png"; } else { } return $logo; }
Best regards,
JosueJanuary 22, 2016 at 3:11 pm #570123Thanks Josue your a diamond!
January 22, 2016 at 3:14 pm #570130Hey!
glad Josue could help. Let us know in a new ticket if you have some more questions related to the theme. We are happy to assist you.
Cheers!
Andy -
AuthorPosts
- The topic ‘Templates with Enfold’ is closed to new replies.