[Support request] Searching using the magnifying glass in menu doesn't follow my searchform.php

Home Forums Support [Support request] Searching using the magnifying glass in menu doesn't follow my searchform.php

Home Forums Support Searching using the magnifying glass in menu doesn't follow my searchform.php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #611168
    Atef

    Hi,
    I have 2 questions, please:

    1- changed the search behaviour from the default “/?s=” to search using Google custom Search engine, based on this tutorial:
    https://www.holithemes.com/wordpress-search-form-as-google-custom-search-engine-search-box/

    I created a searchorm.php and did all the steps correctly.

    It worked great with the search box in the sidebar.

    However, when I search using the magnifying glass in the menu, the result is the default “/s=”, not the google search.

    so how to link the magnifying glass to the searchform.php that I created, so both search methods lead to same results?

    2- I had submitted a previous support thread on how to style the box, becasue when I click on it, it is not clear that something happened. I want to style it to show a white box with black writing ,not a fade overlay. i can’t find this support thread as there is no “my support threads” link, like some other forums.

    so is there a guide on to ti achieve a white box with balck text, when the visitor clicks oon the magnifying glass?

    thanks a lot

    GeneratePress 2.1.2
    GP Premium 1.6.2
    #611252
    David
    Staff
    Customer Support

    Hi there,

    i’ll need to check with Tom in regards to Google Search from the navigation search.

    All of your previous topics and replies are available via the Forum Profile button at the top of the topic. Aside the search field.

    Styling the navigation search can be done like so:

    .inside-navigation .navigation-search input[type="search"], 
    .inside-navigation .navigation-search input[type="search"]:active {
    	/* Your CSS */
    }
    #613084
    Atef

    Hi David,

    thanks a lot. i found my other threads. please let me know when you discuss the navigation search issue, why the magnifying glass does not follow the normal searchform.php approach.
    thanks.

    #613574
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You should be able to use this function:

    add_filter( 'generate_navigation_search_output', 'tu_nav_google_search' );
    function tu_nav_google_search() {
    	return sprintf( // WPCS: XSS ok, sanitization ok.
    		'<form method="get" class="search-form navigation-search" action="%1$s">
    			<input type="search" class="search-field" value="%2$s" name="q" title="%3$s" />
    		</form>',
    		esc_url( home_url( '/search' ) ),
    		esc_attr( get_search_query() ),
    		esc_attr_x( 'Search', 'label', 'generatepress' )
    	);
    }

    Let me know 🙂

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