Integrate Non-WordPress Pages in WordPress

If your like me, you have developed your website over time. If you learned about php before WordPress, you may have had a version of your site that was primarily php. While WordPress uses lots of php, you can’t just import php pages.  One of the beautiful things I was doing with php was using a config file to tell my php pages what text to use on a particular page.

I for example have 5 main types of service I offer, I offer them in many different areas around the county.  So I set up a folder for each area I offer service, and use a config to change the page for each area. You can use a config file to change as much or as little information on a page, but of course Google always prefer more to less.

In the non competitive industries, these config enabled pages ranked very well, while the more competitive ones were more difficult, yet still competitive enough.

I switched my site over to wordpress a few months ago for esthetics and optimizability, but I thought I lost the ability to use my original areas and service pages with the config file, but I was wrong… I found the following code to change my old pages over to use my new word press theme. Just be sure to leave your meta title and descriptions, because you can edited it in your WordPress dashboard.

<!--?php require('../wp-load.php'); get_header(); ?-->
<div id="content">Your page content here.</div>
<!--?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.

Also the div id may need to change as well, just look to your page.php or post.php for the correct div id

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.

Written by

Tom Strubinger was raised in the Mid-West and has lived in South Florida since 1995. He got his first exposure to computer maintenance and programming in 1988, and has been the friend and neighbor everyone relied for computer help, ever since. In 2001 after 911 tragedy, he went back to school and started doing IT Support professionally. In 2004 SoFla Networking was incorporated as a LLC and has been thriving ever since. SoFla Networking now offers Complete IT Solutions including Web Design, SEO, and Social Media Marketing.

No Comments Yet.

Leave a Reply