Splash page on wordpress

In a recent work, with wordpress, needed a splash page before anyone enter in the *real* page. In the index.php of the wp root installation, this is what I have to have it working.

if( (strpos($_SERVER['HTTP_REFERER'], 'riadeaveiro.pt') === false) && !$_SERVER['QUERY_STRING']){
 include './splash/splash.php';
 exit();
}

/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');

So, you should replace riadeaveiro.pt for the domain where the wordpress is, and ./splash/splash.php for the path of the slash page that you want to present to your visitor.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.