Often I’m asked about this whole “wordpress static page thing” and how its used and created. There really are a couple main reasons why most people will want or need a wordpress static page, the first being the need to create a static front page to a blog or site.
What is a wordpress static page?
A static page is really just a page that sits outside of your main blog “root” directory. For instance if your blog is at: http://blainesblog.com/blog/ that would be the root of your blog, a static wordpress page could sit at http://blainesblog.com which is outside of your blog install.
The great thing about using this is you can create a landing page where users will visit and then have a “call to action” which tells the user what they should do right away.
When using this sort of wordpress static page you have the advantage of using the same theme that is used on the rest of your blog, but you can set exactly what displays, for instance you can look at http://thedesktoptutor.com (our wordpress static page) vs. the blog where you are reading this now (http://thedesktoptutor.com/blog). The front page is a static wordpress page that uses our theme and doesn’t require all the coding of the whole header/footer etc.
How do I set up a static page?
It’s very easy to set up your first static page, lets walk through the process:
- Create a blank php page with notepad. You can name it index.php
- Add the wordpress code to the php page:
<?php
define('WP_USE_THEMES', false);
require('./blog/wp-blog-header.php');
get_header();
?>
[put your content here in HTML, or other web coding]
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Note: This path needs to point to where your blog is. For instance if your static page will be at blainesblog.com and the blog is installed at blainesblog.com/blog then this path should read ./blog/wp-blog-header.php The “./” at the beginning tells the script to look at the current folder (blainesblog.com) and then go in the blog directory to find the file wp-blog-header.php
- Now save that page and upload to your webserver.
- You have created your first static page!
Common Errors:
One of the most common errors you will see looks similar to this:
Warning: require(./wordpress/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in http://blainesblog.com/index.php on line 3
Fatal error: require() [function.require]: Failed opening required ‘./wordpress/wp-blog-header.php’ (include_path=’.;C:/Program Files/EasyPHP 2.0b1\php5\pear\’) in http://blainesblog.com/index.php on line 3
This is very easy to fix all it is telling you is that the program cannot find where your wordpress blog is. So just go into the file we last created and adjust the path ( ./blog/wp-blog-header.php) with the correct path that points to your blog.
What Can I accomplish with a wordpress static page?
You can do a multitude of things including but not limited to adding lead capture forms, “the loop” from your blog, recent comments, or really anything else that you can do with a normal page, and the best part is – it looks exactly like the rest of your blog!
Just as a side note I want to mention that if you do not want to display the sidebar you can just leave out the portion of code that reads <?php get_sidebar(); ?>.
In Closing:
As you can see wordpress static pages can be very powerful for many different uses. Stay tuned as I will most likely be talking more about these in the future.
And as always, we welcome your comments, thoughts, and questions below.
Thanks!
Related posts:








December 28th, 2009 at 9:28 pm
Thanks! You just helped me get my blog working again!