End of Year Sale: 30% off your first year on annual plans. Use code AP5-30-OFF See plans

Swiper intro PHP

1 min read
/* 
 * 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 );
WordPress

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.

AppPresser End of Year Sale: 30% off AppPresser subscriptions, now through Dec 31. Two phones show sample news and events apps built with AppPresser.

End of Year Sale

30% off your first year

On Standard, Professional and Advanced annual plans. Enter the code at checkout. Ends December 31, 2026 at 11:59 PM ET.

Code AP5-30-OFF
See pricing