I've been stuck on this all day!
I'm using a custom wp_nav in Wordpress and I need to change one custom menu item from href="http://555.555.5555" to href="tel:555.555.5555". I've added a class="phone" to the menu-item and I'd like to change it using that class (since I can't add a custom id in WP).
I'd prefer it be done onLoad and not onClick. Your help is much appreciated.
The code output by Wordpress is:
<li id="menu-item-654" class="phone menu-item menu-item-type-custom menu-item-object-custom menu-item-654"><a href="http://555.555.5555">Call</a></li>
I need it to look like this using Javascript:
<li id="menu-item-654" class="phone menu-item menu-item-type-custom menu-item-object-custom menu-item-654"><a href="tel:555.555.5555">Call</a></li>
Granted you're comfortable with a little jQuery, load it up in WordPress and paste this into your header, or create an
add_action
forwp_head
.Let me know if that worked for you.
Use my plugin - it's simpler - plus putting jQuery directly into the header is a bit messy. http://wordpress.org/extend/plugins/telephone-number-linker/