You mean you want to create an URL that shows only a single location on the map?
The only thing that’s possible is to create an url that searches for location x, and then restrict the map results to 1, so the nearest one will always show up.
If that’s what you want, then I can send over some code that you have to include in the functions.php to make this work.
Thread Starter
weking
(@weking)
I want to enter a single store link to enter the map. The designated store is displayed first, but the map can still be zoomed to view other stores. I wonder if it is feasible?
Thank You
Thread Starter
weking
(@weking)
The code contained in functions.php can be passed to me for a try to see if it meets my needs?Thank You
function wpsl_custom_search_input() {
$custom_search = isset( $_REQUEST['wpsl-search'] ) ? ( esc_attr( $_REQUEST['wpsl-search'] ) ) : '';
return $custom_search;
}
add_filter( 'wpsl_search_input', 'wpsl_custom_search_input' );
If you create a link that looks like domain.com/store-locator?wpsl-search=london, then it will prefill the input field with London. It will however not auto submit the query.
Thread Starter
weking
(@weking)
I can’t succeed in the test
What doesn’t work? The passed value doesn’t show in the template?
Thread Starter
weking
(@weking)
Sorry
Need to create a template?
How to build.
No, you it should work with the default template. But what’s the problem. The value isn’t set in the input field?
Thread Starter
weking
(@weking)
There’s CSS hiding the input field.
If you add this code to the My Site → Appearance → Customize → Additional CSS, then the input field shows up, and the passed value is set.
#wpsl-wrap .wpsl-input {
display: block;
}