How to create a WordPress splash and static home page

This tutorial describes how to create a splash welcome page in WordPress and have it co-exist with a regular homepage.

Note, april 10, 2015: Since this page is still being read quite often, and both WordPress and my technique have evolved since first writing it, I’ve made some changes. The whole process has become a lot easier and straightforward.

The idea was to create a website with a splash welcome page, which when clicked, would open to the homepage. After the first welcome, the visitor should not be bothered with the splash page again. Since the first article, Ive created many similar constructions, and its easy, youll see!

Requirements for the splash page:

  • no header
  • no footer
  • styling completely different from the rest of the site
  • after the initial welcome, the regular homepage should be just that: the homepage

Okay, here are the steps:

Header

1. Copy the header.php file and rename it to header-splash.php file. You can name it anything you want, as long as it starts with header-.

2. Remove everything below the body tag. You can also remove any unneeded (for this page) scripts triggered in the head section.

3. Add class=splash to the html tag. This makes it easy to differentiate styling later on.

4. You can use the same stylesheet as for the rest of the site, no need to bother with a separate one.

Splash page

5. Copy page.php and name it page-splash.php file in the /wp-content/themes/yourtheme folder.

6. At the top, add the following code:

<?php
/**
 * Template Name: Splash page
 */?>
<?php get_header('splash'); ?>

– The first php part ensures that WordPress sees the splash.php file as a page template.
– The second php part includes the header information from the header-splash.php file.

This ensures WordPress will see page-splash.php as a page template, and show it among the page templates in the WP-admin page editor, and that the proper header
file is called.

7. Open footer.php and copy the content into page-splash.php.

8. Make sure you remove the get_footer(); line from the original page-splash.php file.

9. From the footer, all you will need is the closing of the divs and tags (like main, wrapper, body and html), and any Google Analytics or other scripts you will need on the page.

10. Create a page in WordPress called Splash (or Welcome, or whateveryouthinkisagoodname, and link it to the Splash page template in the page editor. See the screenshot below to see what the page-template selector looks like (default in right sidebar):

11. Now you can put your content inside the page via the page editor.

12. You can also enter the content straight into the page-splash.php file. In that case, you can remove everything within the wrapper div (in this example. How much you should delete depends on the layout of the page you are creating), and then add your new stuff. Dont forget to add a link to the homepage somewhere! For example:

<div class="wrapper">
 <div id="logo">
  <img src="<?php bloginfo('template_directory');?>/images/splash.png" 
                alt="logo" width="55" height="56"/>
 </div>

 <div id="ring">
  <img usemap="#Enter" 
         src="<?php bloginfo('template_directory'); ?>;/images/enter.png" border="0"
              alt="Enter" width="470" height="467" />
  <map id="Enter" name="Enter">
   <area shape="circle" coords="234,232,231" href="<?php bloginfo('home');?>/page_id=5" />
  </map>
 </div>
</div>

Home page

How you create up your homepage is not relevant for this article. You could create another template file (my homepages tend to be quite different from the rest of the site) same as you did for the splash page, but you could also stick with the default page template. Dont forget to add this page as Home to your main menu!

10. Set the splash page as starting page in the WordPress administrator under Settings → Reading.

11. There, you did it! It’s also SEO-proof, as you can configure SEO (I’m a fan of the SEO for WordPress by Yoast) for the splash page in WordPress just like any other page, and you’ve even included the header metadata in the splash page.

This post was last modified on %s = human-readable time difference 14:46

Boris Hoekmeijer

View Comments

  • I was looking for a way to make a splash screen for my website similar to Netflix. Bravo for writing something that is still referred 11 years later.

    I have Tumult Hype 4 to make HTML5 animations but I am not sure how to implement the splash screen logic. None of the splash screen plugins available seemed to support such OAM Widget. So I followed all the steps but I don’t see the Splash template in the page attributes of the block editor. I only see Parent page and Order there. So maybe your code is not actually registering a template in the child theme properly? I don’t know PHP and could really use your guidance.

    • Hi Devansh,
      if you followed the steps closely, the template should be there. I've never tested it with the Gutenberg interface though (I couldn't anymore, the website on which I created this has been offline for a long time). You could try switching to classical editor if you see the page template option in the sidebar then.
      However, I create page templates all the time, and they work just as well with Gutenberg. So I think it's most likely that you made a mistake somewhere.
      All it takes to create a page template, is copy page.php, give it a name like page-splash.php and start with the commment section proclaiming the template (as in the article above). And upload it of course.
      Have you uploaded your template to the active theme? If you uploaded it to the folder of an inactive theme, you will not see the template in the page editor.
      Hope this helps!

  • Note: get_header(splash); in article is wrong, should say get_header('splash'); with quotes.

    • You're right, I corrected it right away. Thanks for pointing it out!

  • Hi Boris, thanks for the tutorial. I don't understand how to keep the visitor ending on the splash page when coming back.

  • Hi Boris, thanks for the tutorial. What I don't quite understand is how the visitor doesn't end up on the splash page when doing a second visit. I'd actually like to make something like this to choose the language for the first visit (afterwards the language is set into a cookie). Thanks!

    • Hi,
      I kept it simple. All I did was add a link to the actual home page to the navigation menu, instead of a link to the splash page.
      If a visitor bookmarks the actual homepage, the splash page is bypassed. If the domain name is simply entered in the URL bar, the splash page is opened.
      Hope that clarifies it for you.

  • Brilliant!

    Unfortunately I'm a very technically-challenged individual, and I'm still struggling to know exactly what to copy from e.g. footer.php..... you say "copy the content", but then in step 9 you say "all you will need is the closing of the divs and tags..." so that's not copying the content, it's copying SOME OF the content?

    I'm getting a bit lost and think it would be really good to show or supply full example files...just so we know EXACTLY what is required in the new header and page files.

    But my goodness, this could be just the solution I'm looking for - if I can understand it ;)

    thanks

    • Hi,
      I will try to help you in the right direction. But honestly, I advise you to dig into the buildup of WordPress pages using the PHP template files a little more. Using headers and footers is not very complicated. What I basically tried to say is:

      • Creating a separate header-splash.php file is necessary because in this splash page, you do not want to see regular header stuff such as a navigation menu. So you take the basic header and strip everything after .
      • The same applies to the footer. Only here, I chose not to use a separate footer-splash.php file and call that from the splash.php template, but instead pasted the required code from footer.php into the splash.php template file directly.
      • Given all that, your splash.php would look something like you see in the example below:

      [php]
      <?php
      /**
      * Template Name: Splash page
      */
      ?>

      <?php get_header('splash'); ?>

      <body>

      <div class="wrapper">
      <div class="inner_wrapper">

      <div id="logo">
      <img src="<?php bloginfo('template_directory'); ?>/images/splash.png" width="55" height="56" alt="logo" />
      </div>

      <div id="ring">
      <img usemap="#Enter" src="<?php bloginfo('template_directory'); ?>/images/enter.png" alt="Enter" width="470" height="467" border="0" />

      <map id="Enter" name="Enter">
      <area shape="circle" coords="234,232,231" href="<?php bloginfo('home'); ?>/index.php?page_id=5" />
      </map>
      </div>

      </div> <!-- end .inner_wrapper -->
      <!-- Everything below is what was pasted from the original footer.php template -->
      </div>

      </body>
      </html>
      [/php]

      I hope this helps, good luck!

  • Excellent write-up. I definitely appreciate this website.
    Stick with it!

Share
Published by
Boris Hoekmeijer

Recent Posts

Agribusiness Service

Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…

10 months ago

CardioThoracaal Chirurgie Zorgpad

Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…

11 months ago

7huijzen Food Quality & Innovation Management

Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…

12 months ago

Prime Housing

Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…

12 months ago

Cor de Kroon

Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…

1 year ago

Hoe leeg je de cache van je browser?

Building your WordPress website efficiently using the 10 tips I documented after years of experience.…

2 years ago