Futcha Splash

On a recent job, the client consistently demanded a splash page for their website. Despite my consistent groans and insistence that the implementation of a splash page on their website would instantly turn it, them and me to the dark side, I gave in.

I reluctantly implemented a quick solution using WordPress. I used php to check if the user was referred to the index page from within the site or from out with the site.

Usually splash pages use an “index.html” page in the website root with a link to a directory such as “blog“. But I had installed WordPress in the root. I could not be bothered moving the installation folder from the root to another folder to suit the splash page nonsense. So I used php with an if statement to check if the user was referred to the site from outside the domain or within and thus display content accordingly:

if( (strpos($_SERVER['HTTP_REFERER'], get_bloginfo('home')) === false) && !$_SERVER['QUERY_STRING']) :
<title>Splash Page</title>
<h1><a href="http://www.yourwebsite.com">Enter</a></h1>
<?php else : ?>
<title>Main Page</title>
<h1>Welcome to the main page</h1>
<h2>By the way Alan is a total ledge!</h2>

In reference to the above code; all that is before the else statement i.e. the following code:

<title>Splash Page</title>
<h1><a href="http://www.yourwebsite.com">Enter</a></h1>

Will be the output splash page. All that is after the else statement i.e. the following code:

<title>Main Page</title>
<h1>Welcome to the main page</h1>
<h2>By the way Alan is a total ledge!</h2>

Will be output when the user clicks enter on the splash page.

35 Comments Add Your Own Comment

(November 2nd, 2008 at 5:36 pm )

Thanks for the info… but what do you name the splash page with the php in the header? The instructions are kinda hard to follow.

(November 7th, 2008 at 12:40 pm )

How would you set that first page up though I mean you can’t make it index.html because there is PHP code inside that page, and I can’t overwrite the index.php that’s already in the root can I?

How does this work?


(January 11th, 2009 at 8:49 pm )

Hey – Thanks for posting this solution. I’m doing some work on a site that will be hosting adult material. Because of this, the owners require a splash page with some disclaimer info.

So, they only want this splash page to be displayed once for a user.

I’ve taken your solution and applied it to my wordpress homepage. All seemed good while testing on firefox and chrome – but IE not so much…

I can’t get past the splash page.

Any thoughts on what to check. I’ve ensured all cookies are accepted.

Thanks in advance!

(February 14th, 2009 at 11:27 am )

ana and Mike – that code would go in index.php in your theme directory, or you could put it in a NEW php file and make that the template file for a static home page.

wordpresshero – thanks for this, nice one! one minor thing, the display of code in your first box there is cut off to the right.

(February 18th, 2009 at 10:35 am )

Thanks, you saved me a lot of time….


(February 20th, 2009 at 12:27 pm )

This one definitely needs some explaining. Since WP breaks down a single page into templates – index.php, header.php, etc – where exactly do you place this script?

(March 1st, 2009 at 5:04 am )

Does this actually work? I’m trying it with little success …

(March 8th, 2009 at 8:32 pm )

Using HTTP_REFERER is *NOT* a good idea for directing your visitors anywhere and should not be relied on. As shown above in the comments, different browsers handle it differently. It can be turned off and on and edited by various security software / anti-tracking plugins and programs. You can easily turn it off in about:config for Firefox etc etc etc. All of which meaning you have no idea where your visitors will land on your site.

(July 13th, 2009 at 11:15 am )

Hi Guys,
Why not just use the WordPress page structure and customize your homepage? You can set the homepage to “home.php” as the permalink in the admin. Then, for the index page you can just set the template to a custom template with the splash page hard-coded in the html. I’ll be doing this for a site of mine. I’ll post the link when it’s live.

(August 23rd, 2009 at 2:59 am )

Hey thank you for the simple and elegant information.

(October 24th, 2009 at 8:12 pm )

okay, I know I probably sound dumb asking this question, but I am so lost in this new language of trying to create my own site. My site will have adult content, And i am assuming what I need is a “splash page” but before anyone can access my blog, I’m hoping for a screen to pop up that will ask the person viewing if they are at least 18 yrs of age, which they will have to click before viewing its content.Does anyone know how to do this?

(December 11th, 2009 at 11:34 am )

Why you dont let CSS and browser history let do this job for you? Refferer and Cookies have ever a problem with paranoid browsers and proxy servers. Simply create a page “splash.htm” in the document root. Than try the following in the footer.php of your theme

.splash a:link {
background-color: #cd0000; position: absolute; width: 100%; min-height:100%; /* Mindesthöhe in modernen Browsern */
height:auto !important; /* !important-Regel für moderne Browser, damit sie die nachfolgende height-Angabe ignorieren */
height: 100%; /* Mindesthöhe im IE */
left:0px; top: 0px; margin:0; padding:0; text-align: center; color: #FFFFFF; font-size: 28pt; vertical-align: middle; }
.splash a:visited { display:none; }


This should also avoid some problems with search engine robots.

(May 11th, 2010 at 12:49 am )

I’ve just tried this without much success, could anyone tell me exactly where you put the code?

(July 15th, 2010 at 3:18 pm )

these instructions are simpler: http://codex.wordpress.org/Creating_a_Static_Fr

(August 21st, 2010 at 5:07 pm )

But Seo matters , otherwise put all links n homepage . But the post is about splash , the author said very well

(September 6th, 2010 at 9:52 am )

Thanks for this article. It helped me to the right path! I had a different scenario, where I wanted a splash page, followed by a static homepage. I also wanted both to be part of the WordPress, so the full website would be SEO-proof. Here's how I fixed it: http://www.ispace.nu/rainbow/archives/175
Hope it helps some of you out!

(September 17th, 2010 at 4:12 pm )

WOOOOOW!!!!!!!!!! you saved my day! At the end my client wanted a splash page. Your code was exactly what I was looking for.


Thank you very much!!

(October 17th, 2010 at 5:25 pm )

Martin, I need to do exactly what you did but I don't see any information clearly on how to do it. Can you assist? Thanks


(October 17th, 2010 at 5:27 pm )

I think it would be nice to know if this was made into index.php or what? There is no instructions on what the page is called.

(January 22nd, 2011 at 5:05 pm )

God, so SMART! I was getting ready to migrate my site to another folder. Thank You!

(February 2nd, 2011 at 10:59 pm )

I got the same problem as Brian. Anyone knows a solution?

(May 18th, 2011 at 1:53 pm )

hi i've found this:

i'm gonna tryin this right now

(June 7th, 2011 at 11:49 am )

Why not you use this simple solutions:

1. Copy all in your index.php to newly created front-page.php

2. In your new front-page.php, set template tag (see how to set page as template)

3. In your new front-page.php, remove header, content, sidebar and footer.

4. In your new front-page.php, include your content (pictures, video, flash or whatever).

5. In your dashboard admin, create new page and name it ” whateveryoumaylike”.

6. Set this “whateveryoumaylike” template page to front-page.php.

7. Go to Setting –> Readings –> Set as “static” and select “whateveryoumaylike” as frontpage.

And.. here you go a front page…

(July 11th, 2011 at 5:59 am )

I thought it could be that easy, too – but all that shows up is my HTML code. Possible deleted too much out of the default template tag code? Going to check again now that someone has suggested it.

I've been trying to modify the plugin Splashscreen for my needs (I just want a normal Splashscreen and not only for over +18. My html code works/looks good but then I'm restricted from entering my own site and can only view the splashscreen….)

(September 17th, 2011 at 5:12 am )

when we must add a light component for splash

(November 24th, 2011 at 7:14 am )

What if I set the page to NoIndex,nofollow!! WIll it unidex my homepage as well? in this same code:

<title>Main Page</title>

<h1>Welcome to the main page</h1>
<h2>By the way Alan is a total ledge!</h2>

(December 18th, 2011 at 12:38 pm )

Best Tips to Secure WordPress Blog/Site here http://how-what.blogspot.com/2

(February 27th, 2012 at 3:17 am )

There's no doubt that this is the very good content, Very useful and informative post. Thanks for writing about this important topic.

(April 5th, 2012 at 5:45 am )


(October 5th, 2012 at 12:38 pm )

Hi I am really a newbie and i don't know much about coding and stuff. Where do I put this code?

(January 29th, 2013 at 7:42 pm )

hi, page called? index.html or index.php or another name?
thank you

(February 11th, 2013 at 3:38 pm )

Where to put the spalsh content ?

(April 9th, 2013 at 5:59 pm )

How do I remove a Splash page, from a wordpress site.
See link

(July 26th, 2013 at 4:55 am )

Thats how i would do it, but i am also going to create header-home.php and footer-home.php and remove any attributes that i dont need, and style things like header background etc with css, i.e changing heights, background images or make them transparent, this way you can still have all your necessary codes etc with little effort

Add Your Own Comment Fields marked * are required.