Digital Point
Digital Point

Reputation: 65

Disable header for a specific page in wordpress

how can i disable header for this specific page. Is there any php function that disables the header for a specific page? In wordpress

Here is the link: https://techmax.ro/elementor-14408/

Upvotes: 1

Views: 1009

Answers (2)

Kaushal Patel
Kaushal Patel

Reputation: 269

Put this condition where the code is done to get the menu.

if(! is_page( 'your-page-slug' ) ){
      wp_nav_menu( array( 'theme_location' => 'your menu name', 'container_class' => 'my_extra_menu_class' ) );
}

Using this there is no extra dom element on this page.

Upvotes: 0

Bhautik
Bhautik

Reputation: 11282

You can hide by CSS and using WP is_page function. check the below code.

function hide_header_on_some_pages(){
    if( is_page( 'yourpagename' ) ){
        ?>
        <style type="text/css">
            .site-header {
                display: none;
            }
        </style>
        <?php
    }
}
add_action( 'wp_head', 'hide_header_on_some_pages', 10, 1 );

Upvotes: 2

Related Questions