I'm using Wordpress with a custom theme.
At the top of the header.php of the theme I've got a Mobile Detect script.
require_once '/extras/Mobile_Detect.php';
$detect = new Mobile_Detect;
Then further down the header.php page I have a line that checks if the user is on a Mobile, and displays different content accordingly.
if ($detect->isMobile()) { echo "Premium"; } else { echo variable('prem_no'); }
However, in a further included PHP file further down the page, when I try to use the same script:
if ($detect->isMobile()) { echo "Find a psychic"; } else { echo "Our Psychic Readers"; }
I get this error:
Fatal error: Call to a member function isMobile() on a non-object in C:\wamp\www\clairvoyant\extraseader-categories.php on line 1
How can I make it so that a file required or included in the header.php file, can be referenced to throughout the rest of the page files?
I'm a bit confused between include, include_once, require and require_once, so can someone help clear that up?