WordPress.org

Ready to get started?Download WordPress

Forums

Get Header() Error in Custom Non-WP Theme Pages (3 posts)

  1. jnbaker
    Member
    Posted 6 years ago #

    Hi,

    I'm trying to create a custom php page within a theme folder.

    I created a page with the standard header, sidebar and footer function calls. I named the file clientlist.php and saved it in the theme folder.

    But, when I tried to load the page via a link, I got a Fatal Error saying get_header() function is undefined.

    1. I didn't change the index.php at root or in wp-admin.
    2. I tried duplicating and renaming existing wp pages and got the same result.
    3. The path to the functions should be the same since the custom php page exists within the same folder as the others.
    4. I tried requiring a path to wp-blog-header.php prior to the get_header() call, but still got get_header() undefined.
    5. I am NOT trying to create a custom index page. This is in one of my theme folders.

    What am I doing wrong, or how can I get non-wp php pages to load common wp functions?

  2. jnbaker
    Member
    Posted 6 years ago #

    OK! I played with it some more and discovered a solution. But it required some editing.

    1. I had remove any define WP_USE_THEMES references. That just botched everything.

    2. I had to use ../../../wp-blog-header.php as the path in the require. For some reason, using an absolute path (with http://www...etc) caused it to fail.

    Thank goodness this worked. I was beginning to lose my mind.

  3. Kafkaesqui

    Posted 6 years ago #

    2. http... is not an absolute path, but rather url. You would want to use something like

    /home/username/www-root/wp-blog-header.php

    That is, the absolute directory path on the server.

    Also:

    http://codex.wordpress.org/Creating_a_Static_Front_Page#Integrating_WordPress

Topic Closed

This topic has been closed to new replies.

About this Topic