[Support request] search placeholder title and previous search dropdown

Home Forums Support search placeholder title and previous search dropdown

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1488443
    Marijana

    Hey there!

    Hope that you guys could help me with this one.

    I have a basic knowledge so the solution is maybe obvious but not to me.

    1. I would like the title Search to be shown in a search field placeholder after clicking on it.

    2. And second, is it possible to stop displaying suggestions for search in a dropdown after clicking on a search bar. Or how can I change it position to center?

    Thanks

    #1488765
    David
    Staff
    Customer Support

    Hi there,

    1. you can add a placeholder using the PHP snippet provided here:

    https://docs.generatepress.com/article/generate_navigation_search_output/#add-a-placeholder

    2. I don’t think thats possible as i believe its related to the browser.

    #1489214
    Marijana

    I still don’t see the text inside the search placeholder in navigation bar.
    But it looks good in the search widget https://prnt.sc/uzf3uj

    Can you suggest more options or a css? I want it to be white.

    Thanks!

    #1489405
    Elvin
    Staff
    Customer Support

    Hi,

    You can try this out PHP snippet out.

    add_filter( 'generate_navigation_search_output', function() {
        printf(
            '<form method="get" class="search-form navigation-search" action="%1$s">
                <input type="search" placeholder="%3$s" class="search-field" value="%2$s" name="s" autocomplete="off" title="%3$s" />
            </form>',
            esc_url( home_url( '/' ) ),
            esc_attr( get_search_query() ),
            esc_attr_x( 'Search', 'label', 'generatepress' ) 
        ); 
    } );

    This adds the “Search” text as placeholder.

    As for question 2: I’ve added autocomplete=”off” as a workaround.

    Let us know if it works for you.

    A wise man once said:
    "Have you cleared your cache?"

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