Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

webstandardcss on "Why will mobile users be redirected to the splash when i'm trying to exclude the"

$
0
0

Why will mobile users be redirected to the splash when i'm trying to exclude them from viewing this page. I just want desktop users to use be redirected to this splash and not the mobile users.

/*-------------------------------------------------------------------------------------*/
    /* Splash Page Hooks and Filters
    /*-------------------------------------------------------------------------------------*/

    // Get the user agent strings.
    $ipod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
    $iphone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
    $ipad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
    $android = stripos($_SERVER['HTTP_USER_AGENT'],"android");
    $windowsphone = stripos($_SERVER['HTTP_USER_AGENT'],"IEMobile");
    if( ! function_exists( 'custom_splash' ) )  {
        function custom_splash( $username ) {
            $referrer = $_SERVER['HTTP_REFERER']; // where did the user come from?
    	// If not mobile user.
    	if ($ipod == false || $iphone == false || $ipad == false || $android == false || $windowsphone == false) {
    	        // if there's a valid referrer
    		if ( empty($referrer) && ( is_front_page() || is_home() ) ) {
    			wp_redirect( '/splash/' ); // Redirect to the splash page.
    		}
    	} else {
    	}

    	return $referrer;
        }
    }

    add_action( 'wp_footer', 'custom_splash' ); // hook splash page

Viewing all articles
Browse latest Browse all 8245

Trending Articles