PHP include error

Discussion in 'Web Design / Development / Programming' started by tomster2300, Jun 7, 2009.

  1. tomster2300

    tomster2300 I like monkeys

    Jul 1, 2003
    The South
    I want to pull and display my wordpress blog in an external page, outside of the wordpress directory. I thought it was possible to do so through...

    include ("../wordpress/wp-content/themes/tremor/index.php");
    but instead I get the following error -

    Fatal error: Call to undefined function get_header() in /home/mcgaheet/domains/ on line 1

    Is it failing because it's assuming that the other php pages like header.php are in the same directory as the page I'm trying to display the blog on? I thought I could just include the index.php page and it would pull everything else from the correct directory (since index.php is not moving from the original directory, but only being included...).

    I hope this makes sense. Does anyone know how to fix this?

  2. Force Flow

    Force Flow Barefoot on the Moon! Staff Member

    Aug 23, 2002
    Northeastern USA
    You'll have to write your own code to pull the correct data to display from the wordpress database, find a code splice that'll do it, get the data from the RSS feed, or display the blog in an iframe.

    Trying to do an include like that simply won't work. Paths and function calls go missing, as you've discovered. Wordpress themes are just that...themes. They require the rest of wordpress to work. By including just the theme's index page, you're missing the rest of wordpress. So, any calls to wordpress functions (such as get_header) return with a "not found/defined" error.

Share This Page