• lyone

    (@davidly22)


    Thanks for providing such a fantastic plugin.
    Let me first say that I’m not a very beginner at web development. So pardon my silly questions. I’ve been trying to call the function in the php code.

    I tried to use the following code to test whether the code detects a phone or a desktop

    <?php if (function_exists(‘wpmd_is_phone’) && wpmd_is_phone()) :?>
    This will show if there is a phone
    <?php else : ?>
    This will show if it is anything but a phone
    <?php endif; ?>

    The above code works. However, as soon as I try to put an ad in between, in doesn’t work anymore. I suspect because is uses javascript and I have no clue about javascript.

    Here is the code I’m using (it displays criteo ads with a fallback on adsense)

    <?php if (function_exists(‘wpmd_is_phone’) && wpmd_is_phone()) :?>

    <script type=’text/javascript’>
    <!–//<![CDATA[
    document.MAX_ct0 =”;
    var m3_u = (location…….
    …..
    //]]>–></script>

    <?php else : ?>

    Another ad

    <?php endif; ?>

    The above code doesn’t work. I tried to put a ‘ before the script but it wouldn’t work.

    Any help would be much appreciated!

    https://www.ads-software.com/plugins/wp-mobile-detect/

  • The topic ‘Can't use the function in php’ is closed to new replies.