Site logo

Archived topic

Menu Bar Icon Not Showing

21 replies · Started by huppap on March 2, 2023

Viewing posts 1–15 of 22

Hi I am trying to add menu bar icon and I have followed this article

https://docs.generatepress.com/article/generate_menu_bar_items/

But after adding the menubar icon it does not show on the frontend for some reason.

Although you can clearly inspect element on it. I am using this code and showing it on entire site using "generate_menu_bar_items" hook element

<span class="menu-bar-item">

<svg version="1.1" class="account-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 120 120" enable-background="new 0 0 120 120" xml:space="preserve"><path d="M84.6,62c-14.1,12.3-35.1,12.3-49.2,0C16.1,71.4,3.8,91,3.8,112.5c0,2.1,1.7,3.8,3.8,3.8h105c2.1,0,3.8-1.7,3.8-3.8 C116.2,91,103.9,71.4,84.6,62z"></path><circle cx="60" cy="33.8" r="30"></circle></svg>

</span>

website is added on the private information area where you can check this.

Thank you.

Hi there,

the hook is working as i can see the HTML, but the SVG has an issue.
Where did you get the SVG from ?

what is the issue with svg icon you see?

I got it from the live site, you can live site at www. instead of dev.

I even tested the svg icon you mentioned here with same issue.

Hmmm... try adding this CSS:

.menu-bar-item a svg {
    width: 1.5em;
    height: 1.5em;
}

I applied it, and it looks kind of funny, and it seems to have changed the color and size for search bar icon too, I wonder why did that happen?

I could live with the color, but could you please help me align these?

Where can i see the issue ?

sorry, you should be able to see it now on dec site.

The alignment issue stems from the cart icon not having any padding.
Try this CSS to correct that:

.cfw_cart_icon_shortcode {
    padding: 15px 15px 25px;
}

.main-navigation .menu-bar-items {
    position: relative;
    bottom: -5px;
}

I applied this css and icons seem to be bit too far apart, could you help me being them closer as you see them on live site, and in that order please?

this is their documentation for adding side cart icon to places. Maybe we can choose a better approach?

https://www.checkoutwc.com/documentation/side-cart/

also is possible to separate navigation from those icons and align navigation to the centre and search and account and cart icons to the right?

Try this CSS to improve spacing:

.menu-bar-items a {
    padding: 15px 10px !important;
}
.menu-bar-items .search-item a {
    position: relative;
    bottom: 2px;
}

And this CSS to center nav:

#site-navigation {
    flex: 1;
}
#site-navigation  #primary-menu {
    margin: auto;
}

Hi Dave, this is perfect, thank you.

Could you also help me arrange menu icons in the header in this order, please.

on Desktop - Search, Account, Cart
on Mobile - Menu Toggle, Search, Logo, Account, Cart (as you see on live site).

This will conclude header for me.

Thank you.

This archived topic is closed to new replies.