• Resolved stlcardsfan

    (@stlcardsfan)


    I’m not necessarily a green coder, but I’m no expert with PHP. I can navigate my way around a web page, but I do have my limits.

    My issue:

    While I could add a category in the nav bar with the phone number, I don’t want to. It’s not visible on mobile, and I want it to be visible in between my logo and the nav bar. To be fair, I’m using the stout theme from GoDaddy, but that theme doesn’t modify the header. Hence why I’m here.

    Any help would be greatly appreciated! Steer me in the right direction and I can add the necessary html and css. It’s a great theme, though.

Viewing 1 replies (of 1 total)
  • Hi @stlcardsfan,

    You can certainly add some additional markup after the site title. Give the following bit of code a try. If you are using a child theme you can add it to your themes functions.php file, otherwise you’ll want to create an MU plugin. We have setup some documentation on setting up an MU plugin here.

    The code you will want to use is as follows (Ideally, you don’t want the inline styles on the anchor tag, but I added them as an example. you may want to move them into a separate stylesheet.):

    Also, in the code below you’ll want to swap out “PhoneNumber” and “Phone Number” in the <a> tag, with the phone number you’d like to display.

    
    /**
     * Add a phone number after the site title.
     *
     * @author GoDaddy
     *
     * @param  string $html HTML markup for the site title.
     * 
     * @return string       Filtered markup for the site title.
     */
    function display_phone_number( $html ) {
    
    	return $html . '<a href="tel:PhoneNumber" style="display: table-cell; vertical-align: middle;">Phone Number</a>';
    
    }
    add_filter( 'primer_the_site_title', 'display_phone_number' );
    

    Let us know how that works for you.

    Best,
    Evan

    • This reply was modified 7 years, 9 months ago by Evan Herman.
Viewing 1 replies (of 1 total)
  • The topic ‘Problem adding phone number to the header’ is closed to new replies.