• Resolved ctuxboy

    (@ctuxboy)


    Hello,

    Here again ??

    For testing, i trying disable/hide the header items, for making a landing page.
    So i disable:
    – sitebranding
    – topbar
    – mainmenu

    The code below works perfect

    
    	function meteorite_nav_topbar() {
    		// remove topbar menu
    	}
    	function meteorite_sitebranding() {
    		// remove sitebranding
    	}
    	function meteorite_nav() {
    		// remove main navigation
    	}
    

    But how can i do this for 1 page (with page ID)?

    I try this:

    if (is_page( 612 )) {
    	function meteorite_nav_topbar() {
    		// remove topbar menu
    	}
    	function meteorite_sitebranding() {
    		// remove sitebranding
    	}
    	function meteorite_nav() {
    		// remove main navigation
    	}
    }

    But doesn’t work.

    PS: i know this is possible with css, but i will try it with the above snippet in the functions.php

    • This topic was modified 7 years, 7 months ago by ctuxboy.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author terrathemes

    (@terrathemes)

    Hello Christophe, @ctuxboy,

    the problem with your second code is that the function.php is loaded way before WordPress knows which page is loaded. That’s why it doesn’t work.
    What you could do is redeclaring the functions with an if construct to check if it’s the page with ID 612 inside of the functions.

    function meteorite_nav_topbar() {
    	if ( is_page ( 6 ) ) :
    		// empty
    	else : 
    		// paste the original code here
    	endif;
    }
    function meteorite_sitebranding() {
    	if ( is_page ( 6 ) ) :
    		// empty
    	else : 
    		// paste the original code here
    	endif;
    }
    function meteorite_nav() {
    	if ( is_page ( 6 ) ) :
    		// empty
    	else : 
    		// paste the original code here
    	endif;
    }

    You should then be careful to update the original code after a theme update to get the latest code if there are any changes to it.

    Thread Starter ctuxboy

    (@ctuxboy)

    Hi @terrathemes,

    Thanks for the fast reply.
    I try this next week.

    Regards,
    Christophe

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable topbar, sitebranding and mainmenu’ is closed to new replies.