Support » Fixing WordPress » SOLVED: WordPress does not include your OWN PHP class in header *AND* footer!

  • Resolved JAB Creations


    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…

    // get_footer();

  • The topic ‘SOLVED: WordPress does not include your OWN PHP class in header *AND* footer!’ is closed to new replies.