• Resolved mikeydiamonds

    (@mikeydiamonds)


    Just a quick question on how to use this awesome plugin.

    Are all the methods from the Mobile Detect PHP library available:
    $detect->isMobile();
    $detect->isTablet();
    $detect->isIphone();
    $detect->isSamsung();

    How do you include in a template file. obviously this won’t work:
    require_once ‘Mobile_Detect.php’;
    $detect = new Mobile_Detect;

Viewing 1 replies (of 1 total)
  • Plugin Author Pothi Kalimuthu

    (@pothi)

    While the plugin was originally developed to modify the core wp_is_mobile function, it is possible to use all the methods from the core MobileDetect PHP library.

    You may use something like the following code…

    $detect = new TinyWP_Mobile_Detect;
    if ($detect->isMobile()) {
      # do stuff for mobile visitors
    }

    These days, certain paid themes and (free / paid) plugins include MobileDetect PHP library on their own. In order to avoid the naming scheme conflict* with those, the library has been renamed to TinyWP_Mobile_Detect.

    Thanks.

    • This reply was modified 5 years, 6 months ago by Pothi Kalimuthu. Reason: fix typo
    • This reply was modified 5 years, 6 months ago by Pothi Kalimuthu. Reason: fix formatting of code block
Viewing 1 replies (of 1 total)
  • The topic ‘Usage’ is closed to new replies.