Creating A Splash Page For Wordpress

July 2nd, 2006, Published in Wordpress, Web Development, 2,234 Views, Email This Email This

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:

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

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

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

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

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

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

<< Contact Example Image Thumbnail Page >>

6 comments so far

  1. Gravatar 1 vlp
    1:16 am - 1-7-2007

    Hi, not very much understood the method. Where do I put this file? If this usefull for something like this - splash page with ad - with link to main page of the blog?

  2. Gravatar 2 jameswillisisthebest
    10:56 pm - 9-8-2007

    This is my first post
    just saying HI

  3. Gravatar 3 Leonaut.com
    2:07 pm - 12-7-2007

    Creating A Splash Page For Wordpress…

    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 su…

  4. Gravatar 4 clone00
    6:48 pm - 1-5-2008

    Well, I get it. Pretty clever. This beats the pants off using a cookie and a javascript generated overlay to simulate a splash page.

    Thanks, we were taring our hairs out.

  5. Gravatar 5 shownomercy
    5:38 pm - 1-9-2008

    This is clever, but doesn’t really work in IE.

    Which leads me to ask, what kind of client would possibly want a splash page that isn’t using IE for their browser?

  6. Gravatar 6 Donna
    3:01 am - 2-10-2008

    This is great in concept but it doesn’t quite work in serving only the splash page once.

Leave a Reply

Your Details

Your Comment