Site logo

Archived topic

Replace the Search Box Text "Search" with "Show Me"

6 replies · Started by Sandra on October 27, 2017

Viewing posts 1–7 of 7

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

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!

Hi there,

I just tried the code and still works perfectly.

What's not working for you?

Any idea how can I get the same result but for the search in the primary menu? The one that opens once you click on the search icon...

Glad you've figured out :)

This archived topic is closed to new replies.