Have you ever put together a cool script or page on your own, and then wanted to integrate it into WordPress so it would have the same look and feel as the rest of your site?
Maybe you have a custom survey you put together with PHP, or a web directory, a Job Board, or some other thing that you can’t really do inside WordPress.
Here’s a bit of code that will help integrate your script with your theme, and will also make other internal WordPress functions available to your script:
<?php
require('../wp-load.php');
get_header();
?>
Your page content here.
<?php get_footer(); ?>
Easy enough? Just make sure the require statement points to the correct path of wp-blog-header.php. This example assumes that your script is inside a directory rather than the root (e.g. /myscript/index.php). If your script is in the same directory as wp-blog-header.php, just change the “../” to “./” ans you’re all set.
Whenever your page is loaded, WordPress will be called upon as well, and your theme will be added in around your script. There’s a small chance that WordPress may conflict with your script though, so be sure to test and change any variables and functions that interfere with WordPress’s internals.

Its interesting to come across this one. Let me try out the code… Thanks!
Thanks, been looking for something like this. Works like a charm!
there is a mistake on get footer function, i’m using wp 2.7 and it works if i write like this : <?php get_footer(); ?>
@firman: Oops, it seems I made a typo.
Thanks for pointing it out.
I am new to wordpress. Can anyone help me to solve the below issue?
Currently when an item is checked out from the shopping cart, it is brought to the payment gateway. However, the seller has no visibility on the item order number and who bought them. Seller wanted to add a reference number on the database that can be linked to the order number on the payment gateway. So, how to intergrate the payment gateway with wordpress?
Thanks
Hi friends,
I am new user of wordpress .
Actually I have to my site integrate with wordpress means i have to show the blogs into into sites But I need a single login screen and after logged in, users will redirect to a common Control Panel. Presently, I hace two control panel one is my site(which is created into plain php) another one is “wp”(after wp installation.)
2. Need to register users from the non-wordpress based site. But I don’t how can I achieve the following:
[A] On registration time, store password in the user table. Please help to create the password with wordpress encrypion.
[B] How can compare the password with database password on login time?
3. Where can I find out WordPress Function References?
I hope that, the comment is active and will help me as soon as possible
I made a page using the code above, put it in a subdirectory and add the “../”. The content I want shows up in the body, but the title says “page not found” and I cannot write over the title with a new title tag. Any ideas?
Work prefect! Going a step further i included to show left and right boxes as well. So my new php page content/form (http://www.devarticles.in/tools/subtitlerep.php) is wrapped in the entire WordPress look now and it works great. Thanks for your great post!
Yay, exactly what I was looking for.
Hint: Use the include and then check what your theme files say (usually single.php will do just fine) to see what to do to get the sidebar (which is get_sidebar()) and stuff.
However: Is there a way to add such pages programmatically – ie. in form of a plugin? For example if I want allow users to upload my plugin, switch it on – and get new page branch /mypluginpages/*
Flattr +1
It worked great with the Google CSE code embeded.
I owe you a beer! I was trying to find a way to allow a rewrite rule to hit a custom PHP page so I could pass “directories” as variables but have the WP theme still be wrapped around it cleanly. After many search attempts I finally hit the right Google search query to find your post. Thanks!
You should embed wp-load.php instead of wp-header.php.
wp-header.php had lots of different (and sometimes random) side-effects for me. E.g. WordPress tried to do a post-loop, but not all the variables are set and this caused actual PHP errors on my non-wordpress page.
When I switched to wp-load.php all errors vanished.
It’s been a few years since I wrote this. You’re right, though. wp-load.php is a better option.
I’ll update the post.