Forums

using tel: links in wp_nav_menu (2 posts)

  1. davidpmccormick
    Member
    Posted 3 months ago #

    Hi,

    iOS recognises links in the format <a href="tel:07954000000">CALL<a/>

    I'd like to add such a link as a 'Custom Link' to a wp_nav_menu that I'm only targeting at iOS (more specifically, only iPhones) but entering "tel:07954000000" in the URL amounts to nothing (it gets wiped when I try to save the menu).

    I suppose these links have to start "http://" (or similar) to work; I wonder if anyone knows of a way in which I could make this work (short of hard coding it in).

    Basically, I'd like a link on my wp_nav_menu which, when tapped, will make a phone call.

    All suggestions much appreciated.

    Thanks,
    D

  2. davidpmccormick
    Member
    Posted 3 months ago #

    I've found a solution.

    I set up the Custom Link with a url that WordPress accepts (eg http://changethisonload.com) and give the menu item a class (eg 'changeonload'), then use jquery to target the anchor tag in the 'changeonload' classed list item:

    $(document).ready(function(){
        $('.changeonload a').attr('href','tel: 07954000000');
    });

Reply

You must log in to post.

About this Topic