[Resolved] Change the placeholder text on the seatch box

Home Forums Support [Resolved] Change the placeholder text on the seatch box

Home Forums Support Change the placeholder text on the seatch box

  • This topic has 5 replies, 2 voices, and was last updated 4 years ago by David.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #905299
    Hasan

    How can I change the default “Search…” text on the search box to something else like “Search Photo”?

    Best regards,
    Hasan

    #905473
    David
    Staff
    Customer Support
    #905478
    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?

    #905481
    David
    Staff
    Customer Support

    Ooops – having one of those days…. this link:

    https://docs.generatepress.com/article/generate_search_placeholder/

    #905523
    Hasan

    Thanks David! 🙂

    Placed this:

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

    And it worked perfectly!

    #905528
    David
    Staff
    Customer Support

    Perfect – glad to be of help.

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