Add Phone Number & Skype To WordPress Nav Menu

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.

ph number

Click to Call Demo

click-to-call

Related Tutorials


Comments

17 responses to “Add Phone Number & Skype To WordPress Nav Menu”

  1. fotod0g13 Avatar

    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

    1. fotod0g13 Avatar

      figured this out on my own- looks like it is all set – sorry for the inconvenience

  2. Brenda Sargeant Avatar
    Brenda Sargeant

    This is such a great resource for me! Thanks 😀

  3. Anne-Marie Avatar
    Anne-Marie

    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!

    1. Brad Dalton Avatar
      Brad Dalton

      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.

      [code]
      add_filter( ‘wp_nav_menu_items’, ‘add_phone_number_second_nav_menu’, 10, 2 );

      function add_phone_number_second_nav_menu( $menu, stdClass $args ){

      if ( ‘secondary’ != $args->theme_location )
      return $menu;

      if( genesis_get_option( ‘nav_extras’ ) )
      return $menu;

      $menu .= sprintf( ‘

    2. %s
    3. ‘, __( ‘run mad as often as you choose’ ) );

      return $menu;

      }
      [/code]

  1. Anne-Marie Avatar
    Anne-Marie

    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.

    1. Brad Dalton Avatar
      Brad Dalton

      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.

      1. Anne-Marie Avatar
        Anne-Marie

        I’ll try it! Can you tell I’m a writer trying to learn code? Thanks so much.

      2. Brad Dalton Avatar
        Brad Dalton

        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.

      3. Anne-Marie Avatar
        Anne-Marie

        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.

      4. Brad Dalton Avatar
        Brad Dalton

        You’re welcome Anne-Marie.

  • Thanks very much, Brad. This is EXACTLY what I needed. Will be bookmarking for future reference!

    1. Brad Dalton Avatar
      Brad Dalton

      No worries Samantha.

        1. Brad Dalton Avatar
          Brad Dalton

          Yes but don’t live there. Melbourne’s weather isn’t to my liking!

          1. You should try Brisbane 🙂

          2. Brad Dalton Avatar
            Brad Dalton

            Brother lives there.

            Lived on Hayman and Hamilton island when i was 20 and loved it. Now in Asia.

  • Leave a Reply

    Join 5000+ Followers

    Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.