Archived topic
Add User icon next to Search icon
7 replies · Started by Gary on August 23, 2021
Hi GeneratePress,
We want to be able to add a user icon that has a custom URL. However, we'd like it on the left of the search icon and to remain in view on mobile too.
Any ideas?
Thanks.
Hi there,
use a Block Element, to add a GB Button Block with your icon and link.
And select the menu_bar_items hook from the list.
https://docs.generatepress.com/article/block-element-overview/
That will display to the side of the search icon on all devices.
Thanks David, that's sorted it.
Glad to hear that!
I came across this thread. I finally figured out how to "turn off" an a social icon element part of generate press. It was appearing in my main-navigation block. It has a hook to main_menu_items. I used "inspect" but can't figure out how that hook got attached to the main-navigation. I want to put it in the Top Bar instead of my main-navigation but don't see anything to hook to in the top bar. Is it not possible? Or I just don't know how to do it?
I'd like to know how the main_menu_items hook works. Is it in the theme files? And if so, I can use my child theme to move it to the top bar once I understand that.
Thanks!
Hi Lauren,
hooks are baked in to the various templates, template parts and functions of the Theme. So you don't move the 'hook' instead you need to find a hook that is relevant to the position you require. Unfortunately there is none in the themes Top Bar as its purely a Widget Area that gets called in the header.php - see here:
Whereas the menu_bar_items hook exists within a function that is called in the Primary Nav and Mobile Header:
So for your Top Bar - options:
a) us the Customizer > Widgets > Top Bar, to add a widget for the social icons.
b) don't use the Themes Top Bar, build your own Top Bar using a Block Element ( or Hook element if you like HTML/PHP ) and Hook it into the before_header hook
Yup, I actually did add social icons myself in top bar. I saw the social icon widget in the Aroma theme and really liked how it was put together, but wanted to put it up top. So I just used the lightweight social icon plugin and put it in the top bar.
Oddly, I originally put it in a block, but when I tried adding the social icons, they didn't show up. I had to remove the outer block. I'm not sure why that happened. Or maybe user error.
Hooks are new to me - so I was playing around with them - I couldn't initially figure out how those social icons were appearing in my nav menu but I got it.
Glad to hear you found a solution!!