Support » Fixing WordPress » Changing header.php files?

  • Resolved Alison


    Hi guys,

    I have found bits and pieces of things online but not anything extensive for the newbie.

    If I have made header files such as:

    How can I get them to show up on the pages that display that header?

    I found this and modified it online, but each time I try to add it to my functions.php file, I get syntax errors.

    if (is_page(‘contact’)){
elseif (is_page(‘gallery’)){
else {

    If theres a plugin that could conceivably rotate header.php files that would be cool, but I cant seem to find this and figure I need to learn this.

    Thanks! A

Viewing 6 replies - 1 through 6 (of 6 total)
  • It may be easier to create new page templates and use your code from the files you noted above to replace get_header in new page templates (then assign new templates to pages desired).

    Solution is quite simple.

    Step 1: rename your header files to

    Step 2:
    In your template files, f.e. index.php or page.php or single.php:
    instead of calling get_header(),
    you call
    get_header(‘contact’); or

    get_header() will call the header.php file.



    Ah! Thanks! Im going to try it! A
    Really appreciate the fast response!

    If anyone else has feedback, im open to all!



    It worked! But I seem to have lost my editing bar when logged in on those pages.
    You know, the grey one at the top from the wp-admin… but it worked! Thanks!

    make sure you have wp_head() included in the new header-XXX.php files.



    Ah, yes, actually it was the <?php do_action('wp_footer'); ?>
    that was missing. My mistake.

    Thanks all!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Changing header.php files?’ is closed to new replies.