• Resolved TheCrack

    (@thecrack)


    Hi,

    I’m trying to add a logo in the navigation bar mobile.

    I replaced this code in the header.php theme child:

    <div class="nav-text"><!-- put your mobile menu text here --></div>

    By this:

    <div class="nav-text"><?php dynamic_sidebar('my-post-ads'); ?></div>

    And I added this CSS:

    #nav-topbar .nav-text {
      display: none;
    }
    @media only screen and (max-width: 719px) {
      #nav-topbar .nav-text {
        display: block;
        width: 50%;
        margin: 0 auto;
        font-weight: 600;
      }
    }

    Now in the navigation bar appears “My Top bar Text”

Viewing 15 replies - 1 through 15 (of 24 total)
  • Can you post a link to your site?

    Thread Starter TheCrack

    (@thecrack)

    My site.

    Here’s the source code on the mobile view:

    <div class="nav-text">My Topbar Text</div>

    What do you have in your sidebar ‘my-post-ads’ widget?

    Thread Starter TheCrack

    (@thecrack)

    I have not created any sidebar with that name

    In your original post you said:

    I replaced this code in the header.php theme child:

    <div class=”nav-text”><!– put your mobile menu text here –></div>

    By this:

    <div class=”nav-text”><?php dynamic_sidebar(‘my-post-ads’); ?></div>

    Maybe instead you replaced it with:

    <div class=”nav-text”>My Topbar Text</div>

    That would explain why the topbar is showing “My Topbar Text”.

    Thread Starter TheCrack

    (@thecrack)

    Yes, sorry, I was wrong

    No problem. So were you able to create a dynamic sidebar and get it into the topbar?

    Thread Starter TheCrack

    (@thecrack)

    So I have to create a sidebar and add it to the top bar?

    Thread Starter TheCrack

    (@thecrack)

    I’ve already read but do not get it

    The easiest way to do it is with a menu and css. Then you don’t need to modify any files. So, to have a clean starting point, I would remove the changes in header.php (or just delete the file from your child theme if you haven’t make any other changes), and remove the css you posted above. Then add a menu item to your topbar menu:

    Menus – Screen Options enable CSS Classes
    Select a Links menu item
    URL is your site
    Link Text blank
    Add to Menu
    After adding to menu, open “Menu Item” and set CSS Class to “topbar-logo”
    Move it to the top of the menu

    Then add the following to your child theme css:

    #nav-topbar .nav li.topbar-logo a,
    #nav-topbar .nav li.topbar-logo a:hover {
      display: block;
      background-image: url(path-to-your-logo-image);
      background-repeat: no-repeat;
      text-indent: -9000px;
      width: 229px;  /* logo width; this may or may not be needed */
      height: auto;
    }

    Give that a try and let me know if you have any questions.

    Thread Starter TheCrack

    (@thecrack)

    Hi Bdbown,

    That’s not what I want, in the topbar and I have the logo, what I want is that the logo in the mobile appear in the navigation bar.

    Thanks.

    The process would be the same; you would just add the menu item to your main menu, and maybe use a different class name, and then target the main menu in the css:

    Menus – Screen Options enable CSS Classes
    Select a Links menu item
    URL is your site
    Link Text blank
    Add to Menu
    After adding to menu, open “Menu Item” and set CSS Class to “menu-logo”
    Move it to the top of the menu

    /* show logo in menu */
    #nav-header .nav li.menu-logo a,
    #nav-header .nav li.menu-logo a:hover {
      display: block;
      background-image: url(path-to-your-logo-image);
      background-repeat: no-repeat;
      text-indent: -9000px;
      width: 229px;  /* logo width; this may or may not be needed */
      height: auto;
    }
    Thread Starter TheCrack

    (@thecrack)

    Hi Bdbrown,

    It has not worked properly, what I want is that this mobile logo on the navigation bar, as you can see in the screenshot:

    screenshot

    Thanks

    I’m not sure which part of the image you’re referring to as the “mobile logo”. Can you post a link to that site? Your current site already has a WebTrickz logo displayed in the mobile view.

Viewing 15 replies - 1 through 15 (of 24 total)

The topic ‘Add logo in mobile navigation bar’ is closed to new replies.