Integrate WordPress into existing website

I started writing a pretty long comment, but I figured I would write it as a solution instead.

If you mix all your files in one big jumble, then it probably wont work. But if you put WordPress in a subdirectory, then it would work (that’s how I used to do it).

REMEMBER!!! If you already have a working WordPress-installation and want to move the posts, then you can’t simply move the files. You’d have to follow the right procedure, which is explained here.

Example of correct file-structure, mixing a static website with WordPress:

|-your-index.php
|-your-page-1.php
|-your-page-2.php
|-your-css
|  |-your-styles.css
|
|-your-js 
|  |-your-js-file.js
|
|-wp     <-- Put your entire WP-installation in a folder
   |-wp-content
   |      |-themes
   |      |-uploads
   |      |-...
   |      |-...
   |      
   |-wp-includes
   |      |-...
   |      |-...
   |
   |-wp-admin
   |      |-...
   |      |-...
   |
   |-wp-config.php
   |-wp-blog-header.php
   |-...
   |-...

This way you can call

<?php require( $_SERVER['document_root'] . '/wp/wp-blog-header.php'); ?>

Then you can keep your own static files and your WordPress-installation seperate and make it work. This is how I used to do it, and that worked.


Flipside

I can see (by Googling a bit), that it looks like that @Bob’s suggestion has become more popular. Here’s an example, using wp-load. I must admit, that I don’t know what the difference is between the two.

This solution suggest a third way of doing it.

But all things considered… Regardless of which way you load WordPress, then I think that it’s your file structure that is your current challenge (if I’m not mistaken). WordPress needs it’s own isolated environment (folder), so it can make it’s URL and call the files as intended.


Final word

But as I suggested in my comment. I used to do this, – and I wish I never did. I wish I had baked my static website into a WordPress-theme.