Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Add search box on primary navigation

  • Hi Teams

    I know there is search modal icon on primary navigation, but my client want search box on the navigation on the right side.

    How can I do that?

    Thanks

  • Hi there,

    use a GP Block Element:

    https://docs.generatepress.com/article/block-element-hook/

    1. go to Appearance > Elements -> Add New –> Block.
    2. in the element settings sidebar set the Hook to menu_bar_items
    3. set the Display Rules Location to Entire Site
    4. in the block editor add a Search block.

  • Thank you, it works!

  • Glad to hear that

  • Hi, I just notice the size of search widget is too high, just not look ok, How can i customize the size of search block?

    Thank you

  • Try this CSS:

    
    .wp-block-search__inside-wrapper :is(input, button) {
        padding: 8px 8px;
        margin-inline: 0;
    }
    .wp-block-search__inside-wrapper {
        padding: 0;
        margin-block: 8px;
    }
    

    And optionally this CSS will make the search bar fill its own row below the hamburger menu on smaller devices:

    
    @media(max-width: 420px) {
        .menu-bar-items,
        .wp-block-search {
            flex: 1 0 100%;
        }
    }
    
  • Thank you, now it’s nicer.

  • Glad to hear that!

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