Jump to content
Rosco5551

Adding tel link to sub menu

Recommended Posts

I am trying to add tel link to a sub menu but it seems only http or file path is supported, does anyone know ho to make this work?

$menuItem->addChild('Call Us')->setUri('tel:+12345678');

Share this post


Link to post
Share on other sites
13 hours ago, Rosco5551 said:

I am trying to add tel link to a sub menu but it seems only http or file path is supported, does anyone know how to make this work?

it seems to support mailto too, but not tel - the quick work around would be to add the link as a label rather than using URI - that allows you to add an a href link as you want to (including tel).

<?php
use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar) {
	
	$primaryNavbar->getChild('Home')->addChild('Telephone')->setLabel('<a href="tel:+12345678">Call Us</a>'); 

});

8GOJIYt.png

the same principle should work in sidebars too if that's where you want to add the link.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines