Site logo

[Support request] search is own its own line

Home Forums Support [Support request] search is own its own line

Home Forums Support search is own its own line

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2584048
    Brian

    When i enable nav search it goes on to its own line. Should it not be beside the links?

    How can put it beside the links?

    Thanks

    #2584354
    David
    Staff
    Customer Support

    Hi there,

    no, the navigation search sits outside the menu, so it will only be inline if there is room for it.

    you can move it inside the menu using this PHP Snippet:

    add_filter('generate_navigation_search_menu_item_output', function(){
        return sprintf(
            '<span class="menu-bar-item search-item"><a aria-label="%1$s" role="button" href="#">%2$s</a></span>',
            esc_attr__( 'Open Search Bar', 'generatepress' ),
            generate_get_svg_icon( 'search', true ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in function.
        );
    });
    
    add_action( 'after_setup_theme', function() {
        remove_action( 'generate_inside_navigation', 'generate_navigation_search' );
        add_action( 'generate_before_header', 'generate_navigation_search' );
    });
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.