• Hello all,

    We’re looking to add a phone number to our home page so that users can tap it and call us directly from their web browser while on mobile. We do not want this number to be visible unless the user is on a mobile device. Is there any way for us to achieve this result?

    Thank you for your time,
    Connor

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’d suggest using something like this (in a child theme, of course):

    <?php if (wp_is_mobile ()): ?>
        <p>Phone 555-4456</p>
    <?php endif; ?>

    Building on the code suggestion to make the number into a tap-able link:

    <?php if (wp_is_mobile ()): ?>
        <p><a href="tel:+1235554456">Phone 555-4456</a></p>
    <?php endif; ?>

    where the + is needed for dialing outside the country and 123 is the area code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hiding a Phone Number Unless User is Mobile’ is closed to new replies.