• I’m trying to define variables based on which OS the user is using. I’d like to define the name and links to each app version, defined in functions.php. Eg

    if (MobileDTS::is('ios')) {
    	$appname = "iPhone app";
            $applink = "http://itunes.apple.com/applink";
    
    } else if (MobileDTS::is('android')) {
            $appname = "Android app";
            $applink = "https://market.android.com/androidlink";
    }

    Once I have defined the variables, I’d like to print them in my template file eg.

    <a href="<?php global $applink; echo $applink; ?>">Download the <?php global $appname; echo $appname; ?></a>

    Is this possible?

    http://wordpress.org/plugins/mobile-detector/

  • The topic ‘Defining global variables’ is closed to new replies.