How to integrate WordPress Elements into a static Website

Posted on March 18th, 2018 under Guides & Tutorials by Chris Lever

Here’s a quick and simple trick to integrate WordPress into a static website. If you’re like me prefers to build out a static website that has dynamic capabilities to extend upon then this tweak will be your new best friend and save you literally hours and hours of coding time. Any WordPress plugin that uses shortcodes will work within a static PHP webpage.

Let’s begin:
Insert the following code at the very first line of a static php page.

<?php require('blog/wp-blog-header.php'); 
status_header( 200 ); 
define('WP_USE_THEMES', false);?> 

Be sure to update the filepath to WordPress. The wp-blog-header.php file sets up all of the variables required by the WordPress environment allowing you to call WordPress elements and plugin shortcodes in a non-wordpress page. There’s dozens of usages such as login forms, multistep contact forms, galleries and many other usages.

I use the technique here on Sitebee to embed contact forms within static non-wordpress page. All that is needed is to call the element or shortcode like this.

<?php echo do_shortcode( '[ffb id=1]' ); ?> 


Calls this:


Thats it, so simple with lots of scope to extend the functionalities of a static php page. All that is needed from you is the replace¬†[ffb id=1] with your shortcode ID. I’ve mastered the technique so if you need any help, get in touch. My standard hourly rate applies.

Spread the love

© 2011 - 2018 - Sitebee Search Consultancy