Archived topic
Navigation item placement, float right without replacing Search and Cart.
9 replies · Started by Martin on June 10, 2021
I am struggling with placing 2 custom "social media menu items" to the right in the menu(side by side with search and woo-cart), while keeping the rest to the left.
No matter what i do, floating these right, replaces the Search and Cart, pushing them into the menu. I need to have them in the order:
Social-icon-1, Social-icon-2, Search-Icon, Cart-icon
Been using the build in classes for the menu items: .menu-item-float-right, as well as using the .menu-item-align-right(that Search and Cart seems to be contained in)
Also tried to force "float:none;" for .menu-item-align-right, and float them individually.
I have been thinking of releasing all items and use flex, but I would like to avoid that, if possible. If it is not possible, a suggestion on how to go about that, is welcome.
Thank you in advance.
Hi there,
you can use a Hook ( or Block ) Element to add items to the hook: generate_menu_bar_items this will add them to the container that holds the search and cart icons.
Use Hook Element if your happy with using HTML
https://docs.generatepress.com/article/hooks-element-overview/
Or the Block Element if you want to use a plugin like GenerateBlocks to add those items:
https://docs.generatepress.com/article/block-element-overview/
Hi David
Appreciate the reponse.
But it seems there is no such hook. "generate_menu_bar_items"
edit: Apperently it is called: generate_after_primary_menu.
thanks.
Hi Matin,
There is a hook called generate_menu_bar_items.
https://www.screencast.com/t/6e3HfytOB
But if generate_after_primary_menu works for you, that will do too :)
Ok. I have looked through 3 sites, in which, 2 of them, did not have the generate_menu_bar_items (only the inside_mobile... was there), and 1 site did have this hook.
I will have to investigate further, as to why it does not show up on some sites.
Thank you.
generate_menu_bar_items was introduced in GP 3.0 with the Flex box structure enabled. Which is why some of your other 'older' sites may no have this hook.
They are all above 3.0
The one I am working on now, in which it also isn't present, is v3.03
It need to be 3.0+ AND Flexbox structure (Customizer > General).
Can you confirm?
Yes. that was it, flexbox was off for the other site. Didnt even know, you could change that... That will make a lot of things much more convenient! Thank you for your help!.
No problem :)