/*
* Set cookie on first visit
*/
function app_is_first_time() {
if ( isset($_COOKIE['_wp_first_time']) || is_user_logged_in() ) {
return false;
} else {
// expires in 30 days, you may want to change this
setcookie('_wp_first_time', 1, time() + (WEEK_IN_SECONDS * 4), COOKIEPATH, COOKIE_DOMAIN, false);
return true;
}
}
add_action( 'init', 'app_is_first_time' );
/*
* Show intro screen if it's a first time visit, or user is not logged in
*/
function app_show_intro() {
$path=$_SERVER['REQUEST_URI'];
if( strpos($path, 'intro') == true || is_user_logged_in() || isset( $_COOKIE['_wp_first_time'] ) )
return;
wp_redirect( 'http://app.reactordev.com/intro' );
exit;
}
add_action( 'init', 'app_show_intro', 999 );
iOS & Android app builder for WordPress
Ready to build your app?
Turn your WordPress site into iOS and Android apps with push notifications on every plan.



