WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. feliciepr7
    Member
    Posted 4 months 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:

    Code:

    <?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
    Member
    Posted 4 months 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
    Member
    Posted 4 months 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
    Member
    Posted 4 months 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:
    <?php
    /*
    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' ) ); ?>
    </div>

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

  5. feliciepr7
    Member
    Posted 4 months 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
    Member
    Posted 4 months 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!

Reply

You must log in to post.

About this Topic