You can customize the existing map controls with this filter.
If you want to create custom button in the search form, then you first have to create a custom template, and in the template include a button that has the ‘wpsl-icon-direction’ class.
Thanks a lot! Using this class on my custom form button, works great. Maybe you should add this tip in the docs.
Oh, and thanks for you super quick response. Excellent support!
Yeah, you’re right. I do need to write an article about this for the documentation section, I will do that soon.
Still on the subject of customization, I think that ids and classes you use for functional pourpose, like #wpsl-search-btn
or the .wpsl-icon-direction
above, should not be used to apply styles to these elements.
For example, when I add the wpsl-icon-direction
class on my custom button to make it trigger the geolocation request, it inherits all css rules used for the default geolocation button and I’m forced to override all rules that don’t apply in my specific custom layout.
It would be great if adding a particular class or id to a user custom element, it would inherit only the required functionality and not even some css rules.
Hi Daniele
Sorry to revive a closed thread but could you share how you made the auto-location button?
@toca711 there is already build in support for the auto location button.
If you enable the “Attempt to auto-locate the user” option on the settings page, then it will show up in the right bottom of the map.
If you want to show it in another location, then this explains how to do so.
@toca711: I’ve created a custom template and added class wpsl-icon-direction
to an input of type button.
Then I’ve added some lines of css style to override the style of .wpsl-icon-direction
<input id="wpsl-custom-locate-btn" class="wpsl-icon-direction" value="NEAR ME" type="button">
Alternatively, you can add some lines of js to trigger the click on the wpsl original button, when a user click on your custom button. Something like this:
jQuery(function($) {
$('#wpsl-custom-locate-btn').on('click',function(){
$('.wpsl-icon-direction').trigger('click');
});
});
-
This reply was modified 4 years, 2 months ago by
Mad Max.
-
This reply was modified 4 years, 2 months ago by
Mad Max.
-
This reply was modified 4 years, 2 months ago by
Mad Max.