Support » Themes and Templates » Calling Different Headers

  • Resolved bradstinyworld


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • for the record there are now blockquotes around code in the theme…

    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

    Thank You! That seemed to do the trick.

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Calling Different Headers’ is closed to new replies.