How To Add A Logo Image To Any Nav Menu

In this post, i’ll show you how to add a logo image to either your primary or secondary navigation menu.

You’ll also be able to float your logo to the left or right of your menu items.

On top of this, you can easily change the position your image sits in your menu.

logo menu genesis

Here’s the PHP & CSS code you need to add at the end of your child themes functions.php & style.css files.

PHP Code

Change the primary theme location to secondary if you want to add your logo in your secondary nav menu.

You’ll also need to upload your image to your media library in WordPress and change the url in the code to your own.

CSS Code

Change the float: left; declaration to float right to display your logo to the right of your nav menu items.

If your image is smaller than the height of the nav bar, you can center it by adding some margin-top:

.nav-logo {
float: left;
margin-right: 20px;
margin-top: 20px;

Works equally as well in the Twenty Twelve & Twenty Thirteen default themes for WordPress.

twenty thirteen theme logo nav menu

2012 image in menu

Using Logo From Images Folder

If you prefer to add your logo to your child themes images folder, you can use this code as another alternative:

Link Your Logo From Images Directory

You might also want to link your image which you can do by using this code as another alternative.

The advantage of using this code is that you can easily change the home_url to any other url template tag and even include a path relative to the home url.

Other Cool Stuff You Can Do With Your Logo

Get The Latest WordPress Tips


  1. Wayne Plant says

    Great stuff Brad!
    I love these posts for the tips and information on modifying WP websites.
    Keep it up.


    Wayne Plant

  2. Joyce Grace says

    Something I really want to try is turning the logo into an SVG, importing that into the IconMoon app, making it part of an icon-font set and then resolving the retina display problem that way. The thing I haven’t tested yet is whether the CSS class on the WordPress menu item would work. I tried inserting a character code into the “Navigation Label” area of a WordPress Menu but that didn’t work, it won’t accept it. I should try a div in that area…a while ago HTML worked in Page Titles….hmmm….

    This would not work with multi-coloured logos but would be a really great solution for one-colour logos….

    • Brad Dalton says

      Hello Joyce

      Interesting question.

      I guess you’ve already tried adding a class to the menu item and doing it that way?

  3. Julie says

    Thank you for this tip.
    However in my twenty thirteen chip theme, my logo goes to the right of the navbar instead of left.
    What do you think I can do, to put it on the left ?
    Many thanks!

        • Brad Dalton says

          Strange because the screenshot near the end of the post shows the result that it floats left when tested on Twenty Thirteen.

          What is this theme that you mentioned?

          twenty thirteen chip theme

          • julie says

            I finally found my mistake! I did not put the css code in the right place, we have to copy it below the .navbar css.
            Now my logo is on the left.
            Thanks :)

          • Brad Dalton says

            That’s right.

            Always at the end of the file before the start of the Media Queries.

            That’s why its called a cascading style sheet!

  4. Michelle says

    Hi — Thank you so much for this excellent code! One question — how can I make this logo hyperlink to my homepage?

    • Brad Dalton says

      Hello Michelle

      Code updated: Simply add your logo.png image file to your child themes images folder and use this code.

      This is not the only way to code this function.

      You could use a different class so it validates for W3 Standards (which i will do and update the code) and you could print the HTML for the image differently.

      Then add list-style-type to the declarations like this:

      .nav-logo {
      float: left;
      margin-right: 20px;
      margin-top: 20px;
      list-style-type: none;

      And that now validates for W3.

      • Michelle says

        Hi Brad,

        Thanks so much for addressing this so quickly! I’m a little unclear on what you’re saying about validating for W3, however. Are you suggesting using the code you just provided with the modified CSS (the one that includes list-style-type: none;) or are you saying that the function would need to be different altogether to validate for W3?

        Also, I’m trying to ensure that when I insert the logo in the navigation menu, it remains to the left of all of the other links in the menu (like the sample images you show). But currently, the logo seems to jump to a second line below the other links in the menu if there are too many items in the menu or if the page size is reduced. How can I tell the function to load the logo first and always make it the first item at left in the menu?

        Thanks again for all of your help!


        • Brad Dalton says

          You can skip that part as i i have updated the code and tested it.

          There’s many different ways to write code that does the same thing.

          PHP is only one side of the solution but doesn’t tell the browser where to output the HTML so you also need to add CSS.

          Its impossible to provide CSS code that works on every theme as there’s 1000′s which are all coded differently.

          I can only provide sample CSS which may need tweaking and/or additions of extra declarations.

          Little bit of work on your behalf is required.

          Watch out for a new post which includes another option for the CSS in a similar solution.

          Something like this may work if you change some of the values:

          .search-form {
          position: absolute;
          right: 105px;
          padding-top: 15px;
          width: 360px;
          list-style-type: none;
          • Michelle says

            Hi Brad,

            I apologize if I was unclear. The search field is fine and the logo is lining up on the left side. But, for some reason, the logo is showing up on a second line below the other menu items. Basically, I’m trying to get the logo to show at the beginning of the menu (the first item with subsequent menu items aligned to the right of the logo).

            How do I make the logo the first to display in the list rather than the last (as it currently is)?

            I understand that CSS is theme/site specific, but this seems like something that should be inserted in the function to tell the logo where to load within wp_nav_menu_items.

            Thanks again for all of your help!!


  5. Michelle says

    Hi Brad,

    Just wanted to let you know that I fixed the issue. The needed to be inside the tag (see code below).

    Thanks so much for all of your assistance!

  6. Michelle says

    Not sure why, but the code didn’t paste in quite right. Basically, though, I just inserted the hyperlink code within the I’ll try again…

  7. tom says

    I am trying to put a larger image than the height of the Nav Bar, The Nav Bar is adjusting to make up for the space, now I have a very high nav bar, is there a way to keep the nav bar the same height, but have the image over hang on the top and bottom?

Ask a Question