How to Remove Header for multiple pages? (6 posts)

  1. feliciepr7
    Posted 1 year ago #

    Hi there,
    I want to remove the header for the rest of my pages and only have it at the home page. I am able to remove it just from One Page Only but dont know how to do the same with the rest. This is what I did:


    <?php if( !is_page( 'en-vivo' ) ) : ?>

    <?php $customheader_on = get_option('dev_studio_customheader_on');

    if ($customheader_on == "yes"){


    <?php locate_template( array( '/library/components/customheader.php' ), true ); ?>

    <?php endif; ?>

    I am using this <?php if( !is_page( 'en-vivo' ) ) : ?> to remove the header for the page en-vivo. Now how can I add the other pages?

  2. Dandy Plow
    Posted 1 year ago #

    You can add other pages to the list with a simple &&:

    <?php if( (!is_page( 'en-vivo' )) && (!is_page( 'some-other' )) && (!is_page( 'this-page' )) && (!is_page( 'your-page' )) ) : ?>

  3. dagal
    Posted 1 year ago #

    I was wondering if there's a code to write in the custom CSS instead of tweaking the code in editor itself. I have tried different things I found on the forum but nothing worked so far (most of those things were apparently outdated :s ). I've contacted the support but haven't received any reply yet.
    My theme is radiate.
    Thank you.

  4. elisabetha
    Posted 1 year ago #

    You can make a copy of the php you work with and place it in the themes folder. Or better make a child of the thems folder so it won't be overwritten with an update of the theme.
    Then in the copy you change the title:
    Template Name: new name

    In this copy you remove the oce that creates the header. This depends on the theme you use. It might be something like

    <div id="gazpo-nav">
    <?php wp_nav_menu( array( 'container_class' => 'main-menu', 'theme_location' => 'header_menu' ) ); ?>

    And you base the pages that don't need the header on this template.

  5. feliciepr7
    Posted 1 year ago #

    @Dandy Plow: I try the code you post and it didn't work for me. This is what I put:
    <?php if( !is_page( 'en-vivo' ) ) && (!is_page( 'videos' )) && (!is_page( 'online-giving' )) && (!is_page( 'contacto' )) && (!is_page( 'peticiones' )) && (!is_page( 'guessbook' )) ) : ?>

    Is that right?

  6. elisabetha
    Posted 1 year ago #

    You should not add the code I wrote down. You must remove the code that creates the header. For your theme that might look different then for my theme. NOTE: only in the template that you use for a page without a header and not for the template for a page with a header!

Topic Closed

This topic has been closed to new replies.

About this Topic