Phone Number in Top Right of Menu Selection Bar

I have been trying to put a clickable phone number in the top right of my header where my company logo and menu selection is but I have not been able to. I checked around the fourm but nothing was quite what I was looking for. I am not good at coding, I was using this code to place the phone number at the top as a bad work around but even that had problems. The number would change on me randomly, making customers call the wrong line. Could someone please help me post my company phone number in the correct place?

<function add_phone_number(){ ?>

  <def class="phone-number-container">
      <!--4233385882-->
      <a href="tel://14233385882">1 (423) 3385882</a>
	<a href="tel://14233385882">Call Us</a>
      </a>
  </div>

<?php }
add_action('x_after_view_global__nav-primary', 'add_phone_number');

Hi Chase,

Thanks for reaching out.

The code should work, but maybe there is a typo error and it should be like this

function add_phone_number(){ ?>

  <div class="phone-number-container">
      <!--4233385882-->
      <a href="tel://14233385882">1 (423) 3385882</a>
	<a href="tel://14233385882">Call Us</a>
  </div>

<?php }
add_action('x_after_view_global__nav-primary', 'add_phone_number');

And you said it’s changing randomly, and I’m not sure how it can be random when the code is static. Would you mind providing more information like how to reproduce it?

And have you tried adding it to top bar content? But yes, adding there will not align it to the logo and navigation.

Thanks!

A few things are my challenge with this code. The first being that its not always but it changes the number to a consistent different number (same number everytime) but it will do it randomly. I havent seen a reason for it yet. The other issue is that I really want it to be apart of the navigation bar and not in a separate bar above the others.

Hello Chase,

If you want the telephone number to become part of the navigation, then you can go to Appearance > Menus and edit your menu that is assigned as your primary menu. You can add a custom menu item and link it to a number.

For example:

Hope this helps. Please let us know how it goes.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.