• Resolved cherylweb27

    (@cherylweb27)


    I’m trying to put a search box at the top right of the website

    dpffredericksburg.com

    I found that I can put it in the Topbar, but I don’t really like it there.(Since I can’t figure out how to get the text to move over to the left side of the topbar, and/or stay on the same line as the searchbox, it simply doesn’t look right and won’t work.)

    I’d like to put a searchbox either in or above the “Main” Navigation area. (On this particular page, I’m using it as the store menu). I’ve tried putting the following code into the Custom CSS box, but it didn’t do anything.

    add_filter( 'wp_nav_menu_items','add_serch_box', 10, 2 );
    function add_search_box( $items, $args ) {
        if ( 'main' == $args->theme_location )
            $items .= '<li>' . get_search_form( 'echo=0' ) . '</li>';
        return $items;
    }

    Any help would be greatly appreciated! Thanks!!!!

    BTW…loving the theme! Great work! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • add this to your custom css box in the theme options > advanced settings to make the text align with the search box in the topbar:

    .topbar-widget .textwidget {
    float: left;
    padding: 6px 0;
    }
    .kad-topbar-right, .kad-topbar-left {
    width:100%;
    }

    As for you code well it’s:
    1. not css so you can’t put it in the css box.
    2. wouldn’t work even if it was put in the right place.
    3. not the best way to add a search box above the primary menu.

    I suggest hiring a developer if you want to do some customizing… there are some things you should do so it can be updated without losing your data, like using a child theme.

    Hope that helps,

    Kadence Themes

    Thread Starter cherylweb27

    (@cherylweb27)

    Wow. Don’t I feel a bit dumb. ?? That’s what I get for trolling the internet for code snippets that I really don’t understand.

    Thanks so much for setting me straight, and your super-fast reply. It worked perfectly!!

    I really appreciate it!! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search Box on Topbar and/or Nav Area’ is closed to new replies.