I am loading second header.php for other homepage but it displaying double header.

this is how i call the second header

<?php get_header('secondheader'); ?>

and file name is: header-secondheader.php

but it shows both header.php and header-secondheader.php displaying double header

how to solve this?

  • 3
    Where are you calling get_header from? Also, you don't have another get_header somewhere, right? – Tomás Cot Sep 16 '14 at 12:00
  • can we see the code in header.php, header-secondheader.php, and your homepage template? – Caleb Sep 17 '14 at 1:45

I'm not quite sure I understand what you're trying to do, but if you're trying to load "First Header" for your home page and "Second Header" for a different home page, some if/else logic should sort that out for you.

I do something like the following if I want a huge hero header on the home page, and something more subtle elsewhere.

In your main header file that loads on every page, where you want to swap headers, do something like this:

    <!--The usual head stuff goes here-->
    <?php wp_head(); ?>

...and so on...

  • I have different homepages, and i can select any homepage from theme control panel. for example for homepage10 i am calling <?php get_header('secondheader'); ?> and this also load the normal header.php and which shows double header content. – Hooshkar Sep 16 '14 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.