Displaying text or HTML in any Genesis theme is easy using widgets but what if you want to add your phone number in a nav menu?
The code snippets in this tutorial, enables you to add your phone number and some text/HTML to the left or right hand side of any navigation menu.
There are multiple snippets included in this post which also enable you to add a click to call phone number as well as a click to Skype link.
The code works in any theme.
Click to Call Demo
Hi Brad-
Is there a way to make a click to call when using the header right widget to show the phone number. Using the Parrallax Pro theme here:
http://harleydavidsonservicenyc.com/
thanks for the help
figured this out on my own- looks like it is all set – sorry for the inconvenience
This is such a great resource for me! Thanks 😀
Hi!
I modified this to add text to my primary nav bar, and I keep getting an error message. Can you tell me where I went wrong?
//* Add tagline to right Genesis primary nav
add_filter( ‘wp_nav_menu_items’, ‘tagline’, 10, 2 );
function add_tagline_nav_menu( $menu, stdClass $args ){
if ( ‘primary’ != $args->theme_location )
return $menu;
if( genesis_get_option( ‘nav_extras’ ) )
return $menu;
$menu .= sprintf( ‘%s’, __( ‘run mad as often as you choose’ ) );
return $menu;
}
But I keep seeing “Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘tagline’ not found or invalid function name in /home/donotfai/newdesign/wp-includes/plugin.php on line 199”
I tried deactivating all plugins, but that didn’t fix it. Thanks in advance! This was a really helpful place to start!
Where did you get the code Anne-Marie?
When you copy and paste code into a webpage you need to use a Gist or wrap it in short-codes otherwise the single quotes turn around causing errors.
You can use any of the code snippets in this post and simply replace the phone number with text.
Oh, I know it looks awful in the comment–I copied what you had here and edited it in Notepad, then uploaded FTP. I changed add_phone_number to add_tagline and ph-num to tagline. Then I replaced your number with my text. Got the error message.
No need to change the filter or function name Anne-Marie.
Simply change the phone number to your text and paste it at the end of your child themes functions file using a text editor and it will work as i have tested all the code.
I’ll try it! Can you tell I’m a writer trying to learn code? Thanks so much.
hahaha. Understand. It’s a challenge writing code which is why i try and make it as easy as possible for people.
The great thing about PHP code is that either works or it doesn’t, unlike CSS code.
It worked! Oh, that’s so much work you saved me trying to figure that out on my own!
PHP code is a more difficult language, but yes, at least it’s either working or broken. CSS just ignores whatever I get wrong, and sends me searching through all 4 million lines of child theme code. 😛
Thank you a million times.
You’re welcome Anne-Marie.
Thanks very much, Brad. This is EXACTLY what I needed. Will be bookmarking for future reference!
No worries Samantha.
Aussie?!
Yes but don’t live there. Melbourne’s weather isn’t to my liking!
You should try Brisbane 🙂
Brother lives there.
Lived on Hayman and Hamilton island when i was 20 and loved it. Now in Asia.