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.