Site logo

[Resolved] Add User icon next to Search icon

Home Forums Support [Resolved] Add User icon next to Search icon

Home Forums Support Add User icon next to Search icon

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1905628
    Gary

    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.

    #1905652
    David
    Staff
    Customer Support

    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.

    #1906677
    Gary

    Thanks David, that’s sorted it.

    #1907146
    David
    Staff
    Customer Support

    Glad to hear that!

    #1907444
    Allan

    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!

    #1907869
    David
    Staff
    Customer Support

    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:

    https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/inc/structure/header.php#L358

    Whereas the menu_bar_items hook exists within a function that is called in the Primary Nav and Mobile Header:

    https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/inc/structure/navigation.php#L467-L493

    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

    #1908321
    Allan

    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.

    #1908459
    David
    Staff
    Customer Support

    Glad to hear you found a solution!!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.