Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Support request] Replace the Search Box Text "Search" with "Show Me"

Home Forums Support Replace the Search Box Text "Search" with "Show Me"

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #411387
    Sandra

    Dear Tom,

    I like to change the text in my Search Box. There’s the text “Search” in the box. It can be seen here: http://prntscr.com/h2rf02.

    But, I want to replace the text with “Show Me”.

    I’ve read the topic here: https://generatepress.com/forums/topic/enter-predefined-text-in-searchbox/ and added the following code into function.php –

    if ( ! function_exists( ‘generate_navigation_search’ ) ) :
    /**
    * Add the search bar to the navigation
    * @since 1.1.4
    */
    add_action( ‘generate_inside_navigation’,’generate_navigation_search’);
    function generate_navigation_search()
    {
    $generate_settings = wp_parse_args(
    get_option( ‘generate_settings’, array() ),
    generate_get_defaults()
    );

    if ( ‘enable’ !== $generate_settings[‘nav_search’] )
    return;

    ?>
    <form method=”get” class=”search-form navigation-search” action=”<?php echo esc_url( home_url( ‘/’ ) ); ?>”>
    <input type=”search” placeholder=”Show me” class=”search-field” value=”<?php echo esc_attr( get_search_query() ); ?>” name=”s” title=”<?php _ex( ‘Search’, ‘label’, ‘generatepress’ ); ?>”>
    </form>
    <?php
    }
    endif;

    But, didn’t see any result. Would you tell me how can I do this!

    Best Regards
    Sandra Johnson

    GeneratePress 1.4
    GP Premium 1.4.3
    #411451
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You can use this filter: https://docs.generatepress.com/article/generate_search_placeholder/

    For example:

    add_filter( 'generate_search_placeholder', 'tu_change_search_placeholder' );
    function tu_change_search_placeholder() {
        return 'Your custom placeholder';
    }
    #443697
    Sandra

    Dear Tom,

    You’ve suggested me to use the following filter to change the default Search … placeholder text

    add_filter( ‘generate_search_placeholder’, ‘tu_change_search_placeholder’ );
    function tu_change_search_placeholder() {
    return ‘Your custom placeholder’;
    }

    But, the problem is that after your recent update of theme, I can’t add this filter to my functions.php

    Please, help me to Replace the Search Box default Text “Search” with “Show Me”

    Best Regards!

    #444004
    Leo
    Staff
    Customer Support

    Hi there,

    I just tried the code and still works perfectly.

    What’s not working for you?

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