Site logo

Archived topic

Change the placeholder text on the seatch box

5 replies · Started by Hasan on May 20, 2019

Viewing posts 1–6 of 6

How can I change the default "Search..." text on the search box to something else like "Search Photo"?

Best regards,
Hasan

Added this to the function.php of the child theme, but did not change anything:

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

May be because the search bar is not in the navigation?

Thanks David! :)

Placed this:

add_filter( 'generate_search_placeholder', function() {
    return "Find photo eg: sadarghat, ahsan manzil"; 
} );

And it worked perfectly!

Perfect - glad to be of help.

This archived topic is closed to new replies.