0

Is it possible to include an entire flat-file HTML site (.html, folders/ and CSS) inside WordPress?

Essentially, I want to host an HTML site, but have access to WP functions and plugins. Not to interested in a iframe solution as that would break the look of the URLs on the browser address bar.

Can I include the html site in WP? Or perhaps include WP in the HTML (with some PHP .htaccess extension magic)?

2

First you need site to be processed as PHP, since WP simply won't work otherwise. I think you can do it for non-.php extensions by tinkering with server config.

THen see Integrating WordPress with Your Website in Codex. You can load WP core to required degree and use the functions.

However I'd consider just migrating site to WP completely.

3
  • Will simply grabbing the header in a standard PHP page as your link suggests load WP plugins?
    – jnthnclrk
    Aug 2 '11 at 21:30
  • Answered my own question by allowing themes with define('WP_USE_THEMES', true);.
    – jnthnclrk
    Aug 2 '11 at 21:32
  • Scratch that, turning themes to true doesn't really help plugins load. Hmmm...
    – jnthnclrk
    Aug 2 '11 at 21:46
2

If I had a site where I wanted to do this I'd convert the layout to a wordpress theme, and then import the pages -- playing with the URL format so that they'd correspond.

Creating a basic theme from existing HTML is pretty easy - see this tutorial for instruction:

http://www.codeislove.net/2011/03/converting-html-layout-into-wordpress.html

http://www.codeislove.net/2011/06/tutorial-converting-html-layout-into.html

You can leave out stuff you're not planning to support - for instance, you might not need the comments, gravatar, sidebars or posts if all you need is full-width pages.

If you can't replicate your URL structure perfectly with the normal WP custom permalinks options, consider redirecting with a plugin, like this one:

http://wordpress.org/extend/plugins/custom-post-title-url/

(I found this in the plugin directory, and haven't tried it or reviewed it closely. Evaluate carefully before using. ) A better option, if you can, would be to 301 redirect the old URLs to the corresponding compatible URL. You can use your .htaccess file, or a WP redirection plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.