WordPress.org

Ready to get started?Download WordPress

Forums

How To Grab Custom Header.php File Created? (not header.php, custom one) (4 posts)

  1. sabster
    Member
    Posted 2 years ago #

    Hey, I made a new header, called "headerpage.php" specically for certain pages on my wordpress site.

    i saw on a random website that to grab a custom php header, you need to use:

    <?php include(“headerpage.php”); ?>

    However, when I do this, I see the following error at the top of my page:

    Warning: include(“headerpagephp”): failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-content\themes\twentyten-child\page.php on line 8
    
    Warning: include(): Failed opening '“headerpagephp”' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\wordpress\wp-content\themes\twentyten-child\page.php on line 8

    I know the file is there, so not sure what is going on... anyone have any ideas?

  2. Andrew
    Forum Moderator
    Posted 2 years ago #

    Try including the file with the relative URL.
    E.g
    wp-content/themes/yourThemeName/headerpage.php

  3. alchymyth
    Forum Moderator
    Posted 2 years ago #

    make sure to use straight quotes in the code:

    <?php include("headerpage.php"); ?>

    what you had possibly came from some uncontrolled copy/paste from a text source.

    even better use

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

    and rename your file to header-page.php;
    http://codex.wordpress.org/Function_Reference/get_header

  4. sabster
    Member
    Posted 1 year ago #

    thank you alchy that worked!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.