Support » Plugin: Mobile Client Detection Plugin » [Plugin: Mobile Client Detection Plugin] Fix for usage device recognition funcs

  • Currently the is_desktop(), is_mobile() and is_tablet() are defined from the query_vars that are set in this plugin. When you want to use these functions before the initiation of WP_Query they return false, because the query_vars aren’t set yet. I suggest to change the functions (bottom of mobile_client_detection.php) as follows, from

    function is_desktop(){return((get_query_var('platform')=='desktop')? true : false);}
    function is_mobile(){return((get_query_var('platform')=='mobile')? true : false);}
    function is_tablet(){return((get_query_var('platform')=='tablet')? true : false);}


    function is_desktop(){return((mcd_get_platform()=='desktop')? true : false);}
    function is_mobile(){return((mcd_get_platform()=='mobile')? true : false);}
    function is_tablet(){return((mcd_get_platform()=='tablet')? true : false);}

    where I use the mcd_get_platform function, called in this plugin to read the $_SERVER[‘HTTP_USER_AGENT’] variable.

    Using these changes, you’re able to use these functions in, for example, the wp_enqueue_scripts hook that’s used in the wp_head() to set device specific scripts.

Viewing 1 replies (of 1 total)
  • Plugin Author syslogic


    I’d have to see, just currently pretty busy and no donations at all yet.

    I’m really not intending to starve from GPL idealism,
    when I can choose daily from several commercial projects.
    It’s like “What do you want to code today?” 🙂

    Nevertheless, thanks for pointing that out, will commit once verified.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Mobile Client Detection Plugin] Fix for usage device recognition funcs’ is closed to new replies.