Archived topic
Replace the hamburger menu
17 replies · Started by Mårten on February 1, 2022
Hello,
I am in the process of replacing the theme hamburger menu with Responsive Menu Pro. What I do not succeed in is placing the new menu in the same place where the hamburger menu theme is located.
If you have the opportunity to help me with that, I would be incredibly grateful.:)
Thanks!
Hi there,
not sure if theres much we can do about that.
If you can share a link to the site i can take a look at what that plugin is doing, it might be helpful
Hi David!
Thank´s for quick reply. Here´s the link to the site: https://safety.concil.se/.
Looking forward to your feedback!
Thanks!
The plugin is hooking its code into the body which means we can't position it accurately to where the themes icon was.
Can you check with the plugin author if the button can be hooked in using code ?
Hi again!
We got info from the plugin author that we have to use a shortcode to put the hamburgermenu at the same place that hamburger menu theme is located. I tried to put the shortcode as a widget in the header and as a hook but don´t succed. Do you know where I can put the shortcode?
Thansk!
You can:
1. Create a new Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
2. Add the shortcode to the Hook text area
3. Set the hook to: generate_menu_bar_items
4. Check the Execute Shortcode
5. Set Display Rules to Entire Site
I´v done according to your instructions but can´t find "generate_menu_bar_items". Is it possible to create a new hooks which are not in the scroll list?
Hi Mårten,
Yes, this is possible. If you wish to add a shortcode which you may hook on to, one way to do it is through adding this short PHP code:
function your_shortcode($atts, $content = null) {
ob_start();
do_action('your_hook_name');
return ob_get_clean();
}
add_shortcode('shortcode_name', 'your_shortcode');
I added this code through the plugin Code Snippets: https://share.getcloudapp.com/eDulrR6P
After doing this, you may use the shortcode as such: https://share.getcloudapp.com/Wnuqm0NO
Also see: https://share.getcloudapp.com/4guZNlxL
As shown above, you may hook onto the “shortcode hook” by choosing Element type: Hook, and Hook name: Custom hook.
Here is a screenshot of the shortcode working from my Test website: https://share.getcloudapp.com/jkumA4l1
Hope this helps! Feel free to reach out if any further help is needed :)
Hey!
A strange thing. The current hook, generate_menu_bar_items, is not found in elements on some of our sites. But available on some sites we have. Why is it like that?
Feel free to take a look at the screenshots.
https://ibb.co/1zxVKNF
https://ibb.co/rf343XS
Hi Marten,
Can you kindly check if the version of GeneratePress in the other sites are updated? This hook was introduced on GP 3.0. This means that a version lower than this wouldn’t have this hook.
Hope to hear from you soon!
Hi,
Everything is updated to the latest versions. But that particular hook is not shown ... Very strange.
The hook is only present if the Customizer > General > Structure is set to Flexbox.
Hi,
The generate_menu_bar_items hooks is now visible. I followed these steps but unfortunately no luck.
:
1. Create a new Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
2. Add the shortcode to the Hook text area
3. Set the hook to: generate_menu_bar_items
4. Check the Execute Shortcode
5. Set Display Rules to Entire Site
This is how it looks. The hamburger menu is above the menu.
https://ibb.co/WvDMRp7
Hi Marten,
I tried viewing the site you linked and this is what it looks like from my end: https://share.getcloudapp.com/KouAG15K
It seems that the “hamburger menu” from the other plugin is inside the navigation already. May we know if you’ll need further assistance with regards to this or perhaps you’re trying to insert a different element?
Kindly let us know. Hope to hear from you soon. :)
Hi,
This is the site we are working on right now: https://2022.concil.se/
The hamburger menu is not in line with the other menu items. We want the hamburger menu to be placed on the far right in line with the other menu choices. I have tried several different ways to make it work but no luck...