Integrating WP in external PHP pages
I have several external pages that use the WP theme engine to wrap the content. I use the method found here, which worked great under WordPress 2.9.2. After upgrading to WP 3.0, these pages no longer worked as expected but instead generated 404s; it turns out the fix is rather simple.
The code to include the WP theme in external pages used to look like this:
-
require('./wp-blog-header.php');
-
get_header();
-
?>
-
<h2>This is the external content.</h2>
-
< ?php
-
get_sidebar();
-
get_footer();
-
?>
The newest version of WP merged the old WordPress Multi-User (WPMU) and the standalone version of WordPress. Since this merger, the new way to include WP in external pages is to change the require() statement to pull in wp-load.php (instead of wp-blog-header.php) like this:
-
require('./wp-load.php');
-
get_header();
-
?>
-
<h2>This is the external content.</h2>
-
< ?php
-
get_sidebar();
-
get_footer();
-
?>
Now your external pages work just like they used to! I found the answer on a BBPress forum post from nine months ago.
Interesting…
One question, have you publish a video as tutorial. If yes please let me know
thank u.