Create a Static Splash Page in WordPress

I know, splash pages are wrong, evil, and will probably bring about the downfall of society. But what if you need one anyway? Say, for example, you are preparing to launch a site based on wordpress but while you’re still putting it all together you don’t want visitors poking around. How can you create a static splash page to tell people that your site is coming soon (whatever that means?)

I found myself in just that situation recently. I looked around for a plugin to let me replace my index with a simple html document for a little while. I may write one yet, but for now a beautifully simple solution is doing the trick. Here’s what to do:

  • Create a blank file in your theme directory and call it something like splash.php.
  • Make it a page template by pasting in the following:
    <?php
    /*
    Template Name: Splash Page
    */
    ?>
    
  • Write your static HTML. If you need to link to images or stylesheets, I suggest putting them in a subdirectory of your theme called something like splash. You can then reference them in your HTML using a bit of code like <img src="/img/spacer.gif"> . Notice the php which finds your theme directory for you so your theme remains portable.
  • spacer Create a blank page and set it to use the custom page template you’ve created. You’ll find it under the Page Attributes menu. As of WordPress 3.1 it’s on the right side of the admin and looks like this image.
  • Under Settings > Reading set the front page to use a static page and select the new page you’ve created. The index of your website will now be your page template with no dynamic content and no other theme files included. Easy-peasy.

Because you never called get_header(), get_sidebar(), or get_footer() you can now have a totally static splash page while you’re tweaking a theme, editing content, and doing your WordPress business in secret behind the scenes. If you still want to pull in some content from WordPress (like the title and page content) you can even grab the loop from your existing page.php and use it in your splash page.

Posted on by Scott Nellé in WordPress

9 thoughts on “Create a Static Splash Page in WordPress

  1. spacer rajesh on said:

    thanks, good tutorial

  2. spacer Bard on said:

    Please help,
    I’m stuck at the 3rd point
    – Write your static HTML…
    It doesn’t show the splash image
    Can anybody post the complete code?
    Thank you

  3. spacer Hafiz on said:

    Can any one help me that what the purpose of PAGE.PHP in wordpress rather than single.php

    .
    .
    .
    waiting ur sweet reply

    • spacer Scott Nelle on said:

      Single.php is for individual blog posts and page.php is for content created under the Pages portion of admin.

  4. spacer Alicia Ross on said:

    Hi, my name is Alicia. I am applying for a job that requires me to make a static splash page for a game art, so they know how my mind works and such. I’m new to static splash page. How do I make one? I have the art skill, I just need to know how to make one, and if there is a program out there to help me out. I tried word press, but it doesn’t seem to want to download properly. I need help! Any suggestions?

  5. spacer Alan Kmiecik on said:

    What if I need to have something in the header to make the page work? Like CSS or JavaScript.

    Thanks.

  6. spacer Alan Kmiecik on said:

    one other thing: What if I want to keep this page out of my themes directory so I can easily change themes?

  7. spacer Debra on said:

    Hi, thanks for the post, but I’m a little confused. How do you reference an external stylesheet? Do you put it in between the head tags of the HTML file or does it go in the header.php? Also what would be the code? Thanks

  8. spacer Eoin Redmond on said:

    Thanks Scott, I was wondering what the best way to do this was!

    Eoin

Comments are closed.