• Hi.

    I think updating the Twenty Twenty theme changed something in how the menu is displayed.

    I have the following code added to functions.php in my child theme to add a search box to the menu:

    /* Add search to menu */
    add_filter( 'wp_nav_menu_items','add_search_box', 10, 2 );
    function add_search_box( $items, $args ) {
    $items .= '<li>' . get_search_form( false ) . '</li>';
    return $items;
    }

    The search box used to display in the same line as my menu items, but now the search box is under the menu items. Is there anything I can do to make the search box go back to the same line as the menu items?

    Thanks in advance.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • In my test system what you describe works fine. Are you sure you are using the TwentyTwenty theme? Maybe it would make sense if you deactivate all plugins and see if it works then. Unfortunately you have a right click lock in your web which makes a more precise check much more difficult.

    The search box on the right is stored in your sidebar as a widget. This can’t have happened just like that, but you must have set it as a widget.

    Thread Starter Mew

    (@gokumew2)

    @threadi
    Hi.

    Yes, I recently moved the search box to the sidebar as a widget because I really didn’t like how it was showing under the menu items.

    Yes, I’m sure I’m using the Twenty Twenty theme. I’ve been using it since it came out and only ever change the color scheme and some other minor adjustments via a child theme. I think it was after the latest update to the theme that caused the search box to no longer appear on the same line as the menu items.

    Sorry about the right click lock. I need it because people take my content.

    As I said, I can’t reproduce this with the actual version and in WordPress 6.0. The search box is displayed for me. Since you already have a child theme, there might be an incompatibility of this one that is the cause. Also plugins you use could be responsible for this, hence my advice above.

    Thread Starter Mew

    (@gokumew2)

    @threadi
    Next time I’m on my PC I’ll give it a try. Could be a plugin that’s causing it but I highly doubt it’s the theme since I’ve not changed anything.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search box in menu’ is closed to new replies.