WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] SOLVED: WordPress does not include your OWN PHP class in header *AND* footer! (1 post)

  1. JAB Creations
    Member
    Posted 6 years ago #

    The header in the XHTML template in WordPress is not passing my site's self-written classes to WordPress's XHTML footer. Obviously I can not redeclare a class in PHP. I attempted to include my own class file in the file that is the common includer for WordPress's header and footer file which is wp-includes/general-template.php however the header file at that point was not able to see the classes defined in my site's class file.

    So...I noticed the wp-includes/general-template.php file was only setting a function...fine so I looked up the function get_header() which is called in WordPress's XHTML master template file index.php in the respective theme folder. I then moved my class include to that file and WordPress still refuses to pass on my site's PHP class to even the header file!

    No, I can not include my class file twice (directly in the header.php and the footer.php files) otherwise I get a blank page.

    The solution I just figured out so if you're customizing your site to the extent I am this is what you need to know...

    Open the WordPress theme folder, open index.php, and comment out the header and footer functions and for goodness sakes...just include it's own the header and footer! Then include your own PHP header file. Here is the general overview of what the code should look like...
    include("../../../my_own_custom_header.php");
    //get_header();
    include("header.php");

    // get_footer();
    include("footer.php");

Topic Closed

This topic has been closed to new replies.

About this Topic