Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #215117

    Zeshan
    Member

    You’re welcome! 🙂

    #723902

    mshetzer
    Participant

    Added the above code to add the Search Bar in the Nav Bar, and the mobile menu is no longer working.

    Here is the site.
    http://www.baldeaglepictures.com/

    Thanks,
    Matt

    #723955

    Lely
    Moderator

    Hello Matt,

    Please update the following custom CSS:

    @media (max-width: 979px){
    .custom-search {
        display: block;
        width: 100%;
        margin-bottom: 10px !important;
        margin-top: 10px !important;
    }
    }

    To this:

    @media (max-width: 979px){
    .custom-search {
        display: block;
        width: 100%;
        margin-bottom: 10px !important;
        margin-top: 10px !important;
        position: relative;
        z-index: -999;
    }
    }

    Hope this helps.

    #724663

    mshetzer
    Participant

    Perfect. Thanks !

    #724919

    Friech
    Moderator

    Glad we could help, Cheers!

    #753310

    isearchlocal
    Participant

    hi, sorry to come onto this thread however i have near enough exactly the same question.

    my issues are that when i implement the above changes it seems to take up the wrong space and looks awful.

    I need it to be like the attached, any suggestions please

    #753629

    Jade
    Moderator

    Hi @isearchlocal,

    Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #754578

    isearchlocal
    Participant
    This reply has been marked as private.
    #754586

    Christopher
    Moderator

    Hi there,

    Please add the code so we can see the issue and provide you with tailored solution.

    Thanks.

    #754593

    isearchlocal
    Participant

    done, added to the nabar.php and also the below CSS added

    .custom-search{
    color: #0157A8 !important;
    float: right !important;
    font-size: 18px !important;
    margin: 20px 5px 0 10px !important;
    width:20%;
    }

    #754637

    Paul R
    Moderator

    Hi,

    Please remove _navbar.php in your child theme then add the code below in your child theme’s functions.php file.

    
    add_filter('wp_nav_menu_items','add_search_box_to_menu', 99999, 2);
    function add_search_box_to_menu( $items, $args ) {
        
        if( $args->theme_location == 'primary' ){
            $items .= '<li class="custom-search">
    <form id="searchform" class="menu-item menu-search" action="'.bloginfo('home').'"  method="get">
    <label class="visually-hidden" for="s"></label>
    <input id="s" class="search-query" type="text" placeholder="Search" name="s"></input>
    <input id="searchsubmit" class="hidden" type="submit" value="Search" name="submit"></input>
    
    </form>
    </li>';
        }
    
        return $items;
    }
    

    Hope that helps.

    #754650

    isearchlocal
    Participant

    hi, really sorry i cant seem to find that php anywhere.
    I have a functions folder and when i enter that i see the attached..

    #754694

    Paul R
    Moderator

    Hi,

    Please delete wp-content/themes/x-child/framework/views/global/_navbar.php

    Then add the code below in wp-content/themes/x-child/functions.php

    
    add_filter('wp_nav_menu_items','add_search_box_to_menu', 99999, 2);
    function add_search_box_to_menu( $items, $args ) {
        
        if( $args->theme_location == 'primary' ){
            $items .= '<li class="custom-search">
    <form id="searchform" class="menu-item menu-search" action="'.bloginfo('home').'"  method="get">
    <label class="visually-hidden" for="s"></label>
    <input id="s" class="search-query" type="text" placeholder="Search" name="s"></input>
    <input id="searchsubmit" class="hidden" type="submit" value="Search" name="submit"></input>
    
    </form>
    </li>';
        }
    
        return $items;
    }
    

    Thanks

    #754751

    isearchlocal
    Participant

    ok, now the nav bar has completed dissapeared

    #754809

    Paul R
    Moderator

    Hi,

    In that case, would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.