SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot tim@getdim's Avatar
    Join Date
    Jul 2012
    Location
    Detroit
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    including Wordpress header in non Wordpress file

    Im trying to include the wordpress header and footer in a non wordpress php file.

    i used <?php include 'filepath' ?>

    and im getting Fatal error: Call to undefined function language_attributes().

    i checked the header file, and this is what i find on the specified line:

    <html <?php language_attributes(); ?> xmlns="http://www.w3.org/1999/xhtml">

    if this unspecified language attribute is a fatal error, why does it work in wordpress?

    after trying to include functions.php i get other errors

    screenshot.png

    what do i need to include to get this to work?

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,849
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by tim@getdim View Post
    Im trying to include the wordpress header and footer in a non wordpress php file.

    i used <?php include 'filepath' ?>

    and im getting Fatal error: Call to undefined function language_attributes().
    That is because the function is never defined because you are not actually running Wordpress. The header and footer files are intended to work with Wordpress. Including them into a non-Wordpress script isn't going to work. My guess is that you want to incorporate the style of your Wordpress into other areas of your site. Is that correct? If so, you are going to have to strip out the HTML you need without the Wordpress-specific code and put it in another file and include that file, not the Wordpress header or footer.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •