The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Using wp_is_mobile to display clickable number for mobile users (2 posts)

  1. matt Pollack
    Posted 2 years ago #

    I am trying to display a html5 clickable phone number only for mobile websites. When the site is being viewed on desktop, I want to display the phone number just as text, not something that can be clicked on and rung. My code doesn't seem to be working:

    if ( $phone ) {
        if ( wp_is_mobile() ) {
        echo  "<a href='tel:$phone'  >$phone</a><br />";
        echo '
        <div class="widget-textarea">' . $phone . ' </div> ';

    The number displays as just text when viewed on a desktop, but the clickable html5 phone number for mobile, doesn't display as clickable.

    Any advice, please? Is this the best way of achieving this?

  2. matt Pollack
    Posted 2 years ago #

    After testing it again, I'm mistaken, it works!

Topic Closed

This topic has been closed to new replies.

About this Topic