Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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
    Rob

    #565136

    Hi 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,
    Elliott

    #565391

    Thanks 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?

    #565557

    Hey!

    – 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!
    Yigit

    #566292

    Thanks 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;
    }
    #566318

    One 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.

    #567998

    Hi 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
    Rob

    #568009

    Hey!

    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,
    Yigit

    #568016

    Thanks 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.

    #568588

    Hi Yigit
    I can’t see what you but logo is working fine now with the array. I just need to add 2 more filters

    1- 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.
    #569688

    Hi!

    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,
    Josue

    #570123

    Thanks Josue your a diamond!

    #570130

    Hey!

    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

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Templates with Enfold’ is closed to new replies.