Shortcode: [cspm_frontend_form]


This shortcode will display a form that you can use to add locations from the frontend of your website. This was introduced in version 3 as a replacement of the v2 shortcode [progress_map_add_location_form].

The shortcode [cspm_frontend_form] supports the following parameters:


map_id (required)

A string name that represents the unique ID of the map.

  • Do not use the string name frontend_form_map! That name is reserved for the main map of the form.
  • If the attribute map_id was not defined, the plugin will call the default ID of the form’s map.
  • If the attribute map_id was not defined and two instances (maps) were called in the same page, the plugin will confuse between them and none of the instances will work.

If you want to save the coordinates using PHP, this is the code you need to use to save your locations:

if(class_exists('CspmFrontendForm') && isset($_POST[CSPM_LATITUDE_FIELD], $_POST[CSPM_LONGITUDE_FIELD])){			
	$CspmFrontendForm = CspmFrontendForm::this();
	$CspmFrontendForm->cspm_save_frontend_location(array(
		'post_id' => THE_POST_ID,
		'latitude' => esc_attr($_POST[CSPM_LATITUDE_FIELD]),
		'longitude' => esc_attr($_POST[CSPM_LONGITUDE_FIELD]),
		'post_type' => THE_POST_TYPE_NAME,
	));	
}

post_id

The post ID to which you want to add coordinates. If not used, the plugin will use the ID of the last inserted post but please note that this is not 100% guaranteed.

Example: [cspm_frontend_form post_id="150"]


post_type

The post type name of the post to which you want to add the coordinates. When not used, the plugin will use your “Main content type”.

Example: [cspm_frontend_form post_type="post"]


embed

Possible values areyes, no. If you want to embed the frontend form inside another form, use this shortcode attribute and use the option yes. This will also hide the “Add location” button of the form.

Example: [cspm_frontend_form embed="yes"]


center_at (optional)

Override the default center point of the map by providing other coordinates (latitude & longitude).

Example 1: [cspm_frontend_form center_at="51.510879,-0.117813"]


width (optional)

The width of the map in pixels.

Example: [cspm_frontend_form width="500px"]


height (optional)

The height of the map in pixels.

Example: [cspm_frontend_form height="500px"]


zoom (optional)

Define the zoom of the map (from 0 to 19).

Example: [cspm_frontend_form zoom="13"]


map_style (optional)

The skin of the map. To get the style name, follow these steps:

  1. Click on the menu “Progress Map”. Wait for the page to load!
  2. Click on the menu “Default Map style settings”
  3. Click the link “Demo” next to the style you like. A new page/window will open, the URL of that page/window holds the style name as the last attribute. So if the URL looks like http://snazzymaps.com/style/42/apple-maps-esque, the style name will be apple-maps-esque.

Example: [cspm_frontend_form map_style="apple-maps-esque"]


initial_map_style (optional)

The initial style of the map. Possible values are ROADMAP, SATELLITETERRAINHYBRIDcustom_style.

Example: [cspm_frontend_form initial_map_style="TERRAIN"]


In the same context