The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Changing header.php files? (7 posts)

  1. anonymical7
    Posted 3 years ago #

    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

  2. Pioneer Web Design
    Posted 3 years ago #

    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).

  3. Peter_L
    Posted 3 years ago #

    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.

  4. anonymical7
    Posted 3 years ago #

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

    If anyone else has feedback, im open to all!

  5. anonymical7
    Posted 3 years ago #

    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!

  6. Peter_L
    Posted 3 years ago #

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

  7. anonymical7
    Posted 3 years ago #

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

    Thanks all!

Topic Closed

This topic has been closed to new replies.

About this Topic