[resolved] Calling Different Headers (5 posts)

  1. bradstinyworld
    Posted 8 years ago #

    I am doing something wrong, but I don't know what. I am trying to write a theme that calls one header on the index.php and a different one for single.php. The headers are named respectively header1.php and header2.php.

    I have tried substituting the call function with the appropriate file name but when I load the blog I get a fatal error. On index.php I start out with
    line 1<blockquote><?php get_header1(); ?></blockquote>

    When i load the blog in a browser I get:

    Fatal error: Call to undefined function get_() in C:\xampplite\htdocs\wtf\wp-content\themes\WTF\index.php on line 1

  2. bradstinyworld
    Posted 8 years ago #

    for the record there are now blockquotes around code in the theme...

  3. csleh
    Posted 8 years ago #

    I am not an expert but have you tried

    <?php include ('sidebar2.php'); ?>

    using an include instead of get-header

    I think that's how you pull in non-wordpress-standard page names.

    Probably also you need this bit of code on top of each custom header page with the appropriate name

    Template Name: Archives with Content
  4. bradstinyworld
    Posted 8 years ago #

    Thank You! That seemed to do the trick.

  5. joefino
    Posted 7 years ago #

    Sorry to jump on this topic late but...

    While using a php include will work the best way to call different headers in WordPress is like this: get_header('HeaderName'). At that point all you have to do is have a header file named header-HeaderName.php in your theme directory.

    Works like a charm and won't break WordPress if you upgrade/make changes.

Topic Closed

This topic has been closed to new replies.

About this Topic