This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Remove logo area, menu on one page

  • Creator
    Topic
  • #5850
    odyn
    Participant

    I need to remove the logo and menu from one specific page (for printing) but would like to preserve everything else. I saw in one of the other theme help (that I don’t own) that at least removing the menu should be quite easy?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #5851
    royeyal
    Participant

    You can the navigation if you add to functions.php the following code (replace “landing” with your page name/slug:

    if (is_page('landing') )
    	remove_all_actions( 'themeblvd_header_menu' );
    #5862
    Jason Bobich
    Keymaster

    To expand on what @royeyal has said for both the logo and the main menu would just be this:

    if( is_page('landing') ){
    	remove_all_actions( 'themeblvd_header_content' );
    	remove_all_actions( 'themeblvd_header_menu' );
    }

    This would go in your Child theme’s functions.php.

    http://dev.themeblvd.com/tutorial/actions/

    http://dev.themeblvd.com/tutorial/primary-framework-action-hooks/

    http://codex.wordpress.org/Conditional_Tags

    Also note that if you’re just talking about printing only, you can always just hide whatever elements with CSS for just the printing on any given page without having to actually construct a page to be printed; that’s another approach.

    @media print {
    	.page-id-123 #top {
    		display: none;
    	}	
    }
    #5897
    odyn
    Participant

    Hm,
    remove_all_actions( ‘themeblvd_header_menu’ );
    seems to be the right direction. Except the if part doesn’t seem to trigger. I’ve tried is_page with slug, with ID, with and without the quotes. I guess I did something wrong somewhere.

    #5908
    karlo
    Participant

    Did you put it in an action?

    like

    add_action ( 'wp', 'switch_navbar_menu');
    function switch_navbar_menu() {
    blah blah
    }

    The wise have told me NEVER just throw in code, always wrap in action. Yes, yes. Another tidbit I picked up is to fire as late as possible but not too late. Well what ever, ‘wp’ works but am open to Jason screaming NOoooo.

    Also I sneak in a question as I did not know which hook to use, I went with “wp”. What I did change menu to a new “secondary” based on a function that check if a page is either X or a child of X.

    Check docs, add_action is used in samples.

    #5909
    Jason Bobich
    Keymaster

    @karlo — lol, the “wp” action is perfect. So, no worries.

    @odyn — Apologies for not taking that into account for you. As this big, bold warning tells us, WordPress conditionals only work after the “posts_selection” (which comes just before “wp”) action hook. — http://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_a_Typical_Request

    So, you’d do something like this:

    function my_remove_header(){
    	if( is_page('landing') ){
    		remove_all_actions( 'themeblvd_header_content' );
    		remove_all_actions( 'themeblvd_header_menu' );
    	}
    }
    add_action( 'wp', 'my_remove_header' );
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.