If you have an adult website, which could include a website about condoms, or drinking alcohol, or “mature” rated video games, you really need a splash screen that tells the visitor to go away if they are under age. Of course, “adult” would also include your traditional “pr0n” website, which may contain nudity or something even “better.”
With Wordpress, this can be done via their “plugin” feature, which I’ve created for your enjoyment and downloading. This is my first “real” plugin for Wordpress so I’m not really sure I’ve done it properly but it does work on my local setup using EASYPHP, as well as hosted on a real server.
How it works:
Basically, a cookie is created when the visitor clicks on “I Agree”, and as long as this cookie is there, the splash screen will no longer appear. Once the cookie is gone, the splash screen will re-appear before the visitor is allowed to continue on to the blog. If you don’t know what a browser cookie is, read this.
To install:
First download the ZIP file onto your computer. Then, extract the zip file content and copy the directory “splashscreen” to the plugin directory located at “wp-content/plugins”. If you’ve never installed a plugin, you should probably read the Wordpress documentation here.
To use:
First, login as an administrator. Next, click on the “Plugins” menu item on the left side (v2.7+). If you installed the plugin properly, you should see “Splashscreen” listed. If you do not see it, there’s a problem with the installation. Click on “Activate” on the right side of this plugin.

Next, click on down arrow to the right of “Settings” to open up the list of options. There should be a new item there called “SplashScreen.”
If you do not see this item, return to the “Plugins” admin menu to make sure that this plugin is activated.
Now, click on “SplashScreen” and you will get the “SplashScreen Settings” page as shown below.
On this screen, click the box to the right of “Enable Splash Screen” to enable this feature.
Below this selection, make sure to select “template” for your default template. We’ll cover how to change this later. Now, click on “Update.”

At this point, you can click on “Visit site” at the upper left corner of the administration page to view your website. If you are using the default Wordpress template, you will get something that looks like the image below.

As is, if you click on “I Do Not Agree,” you’ll be taken to google.com. If you click on “I Agree,” you will be taken to your regular blog page. Using the default SplashScreen template, once you have clicked on “I Agree” once, you will not see this splash screen again until you close your browser and re-launch and re-open the website.
You can see a demo of this plugin at an adult website — alexisbreeze.com. Obviously, don’t go there if you don’t want to see pr0n. Actually, there’s just some bikini pictures there right now but if you see this post later on, there might be more.
To customize:
You can change the splash screen to your needs by copying the file “template.htm” to another name. Do not change “template.htm” so that you can use this as your backup in case you screw something up. The extension must be “.htm” for the plugin to be able to find your template and list it for selection. For example, you can copy it to “mysplash.htm”.
If you don’t know anything about HTML, you probably should not be touching the template, or just change the text only and nothing else.
The file will look like the code below.
<?php get_header(); ?>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from old browsers
function setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function setsplash() {
setCookie("splash", "1", "", "/");
}
//-->
</SCRIPT>
<div align="center">
<h3>To enter this website, you must agree to the terms below.<h3>
<table border="0" align="center">
<tr>
<td colspan="2">
<FORM>
<P><TEXTAREA NAME="comments" COLS="70" ROWS="7" READONLY>The material contained
herein is intended for mature audiences and is not suitable for persons under the age of 18. If you are under
18 or feel you would be offended by this type of material, please exit this site.
By using this website, you agree to the Terms of Service below. Please read them carefully. This Terms of
Service is a binding contract between you and this website. If you do not agree with any of these terms,
please exit this website.
TERMS OF SERVICE:
Blah Blah Blah</TEXTAREA><br />
</td>
</tr>
<tr>
<td align="left"><h2><a onclick="setsplash()" href="">I Agree</a></h2></td>
<td align="right"><h2><a href="http://google.com/">I Do Not Agree</a></h2></td>
</tr>
</table>
</div>
<?php get_footer(); ?>
Do NOT change anything above the “div” shown in yellow. You can pretty much change everything between the 2 yellow lines, except for the code that is in cyan (the light blue color). Whatever link you create to go to your blog must contain the call to the “setsplash” javascript function which sets the cookie that tells the plugin that the visitor has seen the splash screen.
For example, if you want to ask the visitor if they are “18 and over”, replace the text, “I Agree” with that text.
Also, you will have to add your own text for your “terms of service” and add it where it now says, “Blah Blah Blah.”
As is, this template will cause the splash screen to appear once until the browser is closed. Then the cookie is erased automatically and the visitor will once again see the splash screen.
However, if you want the browser to remember that the splash screen was already shown on the visitor’s computer, you can replace the “setsplash” function with the one below. By doing this, the cookie will remain even after the browser is closed. Replace the area in green highlights above with the following code.
function setsplash() {
var exp = new Date();
var expDays = 365;
exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000));
setCookie("splash", "1", exp, "/");
}
By the way, when you click on the “Update” button in the setup screen, it automatically clears the cookie so that you will be able to test the splash screen without having to manually delete the cookie or close your browser.
To download:
Download version 0.01 (beta) here.
Hopefully, there will be people that will find this plugin to be useful. If you find this plugin useful, please encourage me to do more coding by making a small donation.
Updated May 14, 2009:
Version 0.20 is released.
Updated December 3, 2009:
Version 0.30 is released.
Responses to “Wordpress plugin for splash screen”
-
-
Having it for certain pages or posts would be a bonus, otherwise the plugin is cool.
Keep up the good work.
-
“Is this for something like a “adults only” section that would be in a specific category?”
Yes, exactly. Especially for stuff on special pages. For example, if it’s blog that has fiction posted on pages, there could be some that have adult concepts and others that are free for the kids. Or think of the artists: they may have galleries on a few pages that are perfectly okay for 6 year olds to look at and then another page where they’ve got some pictures that are for adults only.
I think that would be very very useful if you could use the splashscreen in a flexible way like that!
-
can this plugin be modded to display a a text for a certain period than redirect the user to another page? and if he comes back with the cookie set, redirect him straight without displaying the splashscreen?
-
Where’s template.htm stored?
-
My bad. found it in wp-content/plugins/splashscreen/ , of course. My FTP client wasnt refreshing the server view.
-
Works like a charm. I desperately needed a plugin like this for about two weeks now. Tried to implement something from WordPressHero, but it was a half-baked explanation that led nowhere. Cheers, mate! You really saved my butt!
-
Could the extension of ‘htm’ be changed to ‘php’ in this line of splashscreen.php:
if( !is_dir($dir . $file) && strtolower($ext) == ‘htm’ )Thanks,
Peter -
Yes, there is a specific reason I would like this. I have a custom splash screen page (ageverify.php) that I would like to use as the splashscreen that has some php in it: (print $domain = GetHostByName($REMOTE_ADDR);)
It’s not absolutely necessary but….
I have the ageverify.php page going to another php file also which records electronic signatures in the database. Maybe I should just something else rather than your plugin to do this?
Not sure if I’ve explained myself well enough. If not, I could email you the file so maybe you could see what I’m saying. I don’t mean to cause any undue problems or anything. Thanks for any help/advice you are able to give.
Pete -
love the plug-in, BUT…
it disables the RSS link for feedburner. the splash page won’t go away in order for someone to subscribe. this doesn’t make sense to me since it is not even on my domain.
-
even if they have clicked to enter the site and are on the main content, once they click the rss feed (using Feedburner) the splash screen comes back up.
in reality i just need a splash screen if a user is entering to the index page for the first time (or even better if they are not logged in) – like most sites.
-
First off, thanks for this amazing plugin. It rocks!
I’m having the same issue with the RSS feeds. Because the rss reader is trying to access the feed from the site, it’s hitting the splash page and not returning the feed.
Is there a workaround for this?
thanks!
-
By on June 1, 2009 at 7:11 am
Great job.
But I need help lil bit. It adds cookie but I don’t want it to add cookie. I want if visitor see splash page everytime when he join my site again.
how can I do that?
ps: sorry that my english isn’t good as I would like.
keep up the good works.
-
By on June 2, 2009 at 5:09 am
Thanx for reply.
Well, actually I want the splash page to appear again when they return the site without close browser. How can I do that?
-
By on June 2, 2009 at 12:02 pm
my english sucks.
dude, I want splash screen but I want when you click “Enter the site” delete cookie automaticly. Not at browser restart. Hope you understand.Thanx again for your reply. Keep up the good works.
-
By on June 12, 2009 at 9:35 am
first, let me say – brilliant and thank you.
now, onto the small problem.
If someone logs onto “painandwonder.com” and clicks “enter” they go right in. If someone logs onto “www.painandwonder.com” and clicks “enter” they get the same splashscreen and have to click “enter” again.
Any ideas on how to get it to go right into the website no matter which “link” they go to?
Thanks for your help in advance.
-
By on June 20, 2009 at 6:24 pm
Work in wordpress 2.8?
-
And how the search engines works with this plugin?
There are some restrictions? -
By on July 7, 2009 at 8:09 am
hi!
can i have a page with a flash animation as a splash page?i’m have some problems doing that
thanks
-
By on July 24, 2009 at 4:46 am
Hi, This plugin is exactly what I need, but it doesn’t seem to work under 2.8.2
I’ve installed and activated, but there’s no screen like the one above for setting the template – can I do that somehow in the code, do you think?
Thank you for your excellent work!
S
-
I've been experimenting with your plugin and I think it's great. I'm developing a Wordpress website where I need a splash-screen to ask users to select between 2 languages. I can can get the plugin to work fine and it remembers a cookie for the first language, but then no cookie is set if someone clicks on the second language and the user sees the splascreen again – there's no way into the website.
Is it possible to get the plugin to set 2 different types of cookies, depending on which language is selected?
-
can you use this for a specific page rather than the whole site?
-
great thanks!
-
Hi, looks cool. Question: does this block Google's search activity when they want to index a site? G.
-
How can I use this two record two different values in the cookie. For example, if they click on English (instead of I Agree) they will be redirected to "index.php/?lang=en", if they click on Spanish (instead of Do Not Agree) they will be redirected to "index.php/?lang=sp"
-
Thanks for your answer…
Would it be possible to only change the value in the cookie. Than, instead of looking for two cookies, the PHP code could redirect according to the value it finds in the cookie…i.e. to link1 if value=1 or link2 if value=2 ? Do you know how we could modify the code to do so ? -
Installed the update and cant find the SETSPLASH() function to change the cookies
function setsplash() {
var exp = new Date();
var expDays = 365;
exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000));
setCookie("splash", "1", exp, "/");
}Perhaps the next version could have this as a setting in the options? In the meantime – what exactly do I replace with the code above?
Thanks Again! Great Plug In
-
It would be nice if there was a setting for only the home page, or specific pages. An include path might be more effective than an exclude path.
Also, the plugin would destroy a site's SEO. It should check for known robots agent and exempt them from the splash screen.


Is it possible to have the splash screen appear only when the visitor wants to access certain pages?