How to Change Default Text for Near Me Search?

When using Location Manager, you can add a Near Me feature to your search bar, that shows locations that are in proximity to user's location

You can replace the default "in" text shown in search results with "near" using the following code snippet: 

We recommend using the Code Snippets plugin. 

function gd_snippet_210216_location_suggest_more() {
	$near_add = trim( geodir_get_option( 'search_near_addition' ) );
	$near_add2 = trim( apply_filters( 'geodir_search_near_addition', '' ) );
?>

<script type="text/javascript">

function gdlm_ls_maybe_suggest_more() {
	if ( gdlmls_doing_search == 0 && ( ( gdlmls_country.length == 0 && gdlmls_region.length == 0 && gdlmls_city.length == 0 && gdlmls_neighbourhood.length == 0 ) || gdlmls_is_search ) ) {
		$input = jQuery(gdlmls_selected).val();
		if ($input) {
			$input = "Near " + $input;
			<?php if ( $near_add != '' ) { ?>
			$input = $input + ", <?php echo stripslashes( $near_add ); ?>";
			<?php } if ( $near_add2 != '' ) { ?>
			$input = $input<?php echo $near_add2; ?>;
			<?php } ?>
			if ((typeof google !== 'undefined' && typeof google.maps !== 'undefined')) {
				gdlm_ls_google_suggestions($input);
				}
			} else {
			jQuery(gdlmls_selected).parent().find("ul.gdlmls-more").empty();
			}
		}
	}
</script>

<?php }

add_action( 'wp_footer', 'gd_snippet_210216_location_suggest_more', 11 );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us