Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
wp-map-picker
Advanced tools
This jQuery plugin for WordPress can be used to transform an input field into a flexible map field with a location picker.
This jQuery plugin for WordPress can be used to transform an input field into a flexible map field with a location picker.
The preferred method to install this package is to use NPM.
npm install wp-map-picker
To include the script and stylesheet, enqueue the script and stylesheet like so:
<?php
$gmaps_url = add_query_arg( 'language', str_replace( '_', '-', get_locale() ), 'https://maps.google.com/maps/api/js' );
wp_enqueue_script( 'google-maps', $gmaps_url, array(), false, true );
wp_enqueue_script( 'wp-map-picker', 'PATHTOMAPPICKER/wp-map-picker.min.js', array( 'jquery', 'jquery-ui-widget', 'jquery-ui-autocomplete', 'google-maps' ), '0.7.1', true );
wp_enqueue_style( 'wp-map-picker', 'PATHTOMAPPICKER/wp-map-picker.min.css', array(), '0.7.1' );
Make sure to use the proper hook to enqueue the assets, for example in the admin_enqueue_scripts
hook. Furthermore the dependencies in the above code sample must explicitly be included, otherwise the plugin will not work. Note that the above example will also load the Google Maps API in the current language set in WordPress.
To turn your raw and boring input fields into really exciting map picker fields, you simply need to run the main plugin function wpMapPicker()
on your jQuery elements. For example:
jQuery( '.custom-map-field' ).wpMapPicker();
The plugin supports numerous settings so that you can tweak how your fields work. There are two ways to apply settings to a field: Either specify the settings (as an object) when initializing the plugin in Javascript, or apply them as data attributes on the field.
Here you find a list of all available settings:
store
:
storeAdditional
:
zoom
:
draggable
:
mapType
:
defaultLocation
:
lat
for the latitude default, lng
for the longitude default and zoom
for the initial zoom level used when the default location is applied){ lat: '0.0', lng: '0.0', zoom: 2 }
decimalSeparator
:
change
:
clear
:
There are a number of methods that you can call by using a construct like jQuery( '{{SELECTOR}}' ).wpMapPicker( '{{NAME_OF_FUNCTION}}' {{,FUNCTION_PARAMS}} )
.
clear
:
refresh
:
I'm always grateful for contributions, whether it is about enhancements or bugfixes, especially since the plugin is at an early stage. If you encounter bugs, compatibility issues or totally missing functionality that must be in this plugin, I would appreciate if you created an issue. Or even better, if you can, do it yourself and open a pull-request.
FAQs
This jQuery plugin for WordPress can be used to transform an input field into a flexible map field with a location picker.
We found that wp-map-picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.