OSM OpenStreetMap Shortcodes

Below, you’ll find a detailed guide on how to add the OSM OpenStreetMap Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the OSM – OpenStreetMap Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the OSM OpenStreetMap Plugin and the shortcodes it provides:

Plugin Icon
OSM – OpenStreetMap

"OSM – OpenStreetMap is a dynamic plugin that integrates the power of OpenStreetMap into your WordPress site. With OSM, you can easily display interactive maps, enhancing your site's functionality."

★★★★☆ (127) Active Installs: 10000+ Tested with: 6.0.6 PHP Version: 5.3
Included Shortcodes:
  • [osm_map]
  • [osm_map_v3]
  • [osm_image]
  • [osm_info]

OSM OpenStreetMap [osm_map] Shortcode

The ‘osm_map’ shortcode is a feature of the OSM plugin in WordPress. This shortcode displays a map on your website. The ‘sc_showMap’ function generates the map output. It includes the ‘osm-sc-osm_map.php’ file, which contains the map’s details and settings.

Shortcode: [osm_map]

Examples and Usage

Basic example – A simple shortcode to display an OSM (OpenStreetMap) map on your WordPress site. The shortcode doesn’t require any parameters, which makes it easy to use for beginners.

[osm_map /]

PHP Function Code

In case you have difficulties debugging what causing issues with [osm_map] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('osm_map',array(&$this, 'sc_showMap'));

Shortcode PHP function:

function sc_showMap($atts) {
    static  $MapCounter = 0;
    include('osm_map/osm-sc-osm_map.php');
    return $output;
  }

Code file location:

osm/osm/osm.php

OSM OpenStreetMap [osm_map_v3] Shortcode

The OSM Map V3 shortcode is a function in the OpenStreetMap plugin that allows for map embedding. It uses the ‘osm_map_v3’ shortcode to display maps. This shortcode uses the ‘sc_OL3JS’ function, which includes a map counter and the ‘osm-sc-osm_map_v3.php’ file. The function returns the output, displaying the map on your website.

Shortcode: [osm_map_v3]

Examples and Usage

Basic Example – A simple implementation of the ‘osm_map_v3’ shortcode without any additional parameters. This will display the map with its default settings.

[osm_map_v3 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [osm_map_v3] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('osm_map_v3',array(&$this, 'sc_OL3JS'));

Shortcode PHP function:

function sc_OL3JS($atts) {
    static  $MapCounter = 0;
    include('osm_map_v3/osm-sc-osm_map_v3.php');
    return $output;
  }

Code file location:

osm/osm/osm.php

OSM OpenStreetMap [osm_image] Shortcode

The OpenStreetMap (OSM) plugin shortcode ‘osm_image’ displays an image on your WordPress site. This shortcode calls the ‘sc_showImage’ function, which includes the ‘osm-sc-osm_image.php’ file, generating the output.

Shortcode: [osm_image]

Examples and Usage

Basic example – A simple usage of the osm_image shortcode to display an image.

[osm_image id=1 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [osm_image] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('osm_image',array(&$this, 'sc_showImage'));

Shortcode PHP function:

function sc_showImage($atts) {
    include('osm-sc-osm_image.php');
    return $output;
  }

Code file location:

osm/osm/osm.php

OSM OpenStreetMap [osm_info] Shortcode

The OpenStreetMap (OSM) plugin shortcode, ‘osm_info’, is used to embed map information on your WordPress site. This shortcode executes the ‘sc_info’ function, which includes the ‘osm-sc-info.php’ file. This file generates map data, which is then returned as output, adding detailed map information to your web page.

Shortcode: [osm_info]

Examples and Usage

Basic example – The shortcode ‘osm_info’ without any parameters will simply include the ‘osm-sc-info.php’ file and return the output.

[osm_info /]

PHP Function Code

In case you have difficulties debugging what causing issues with [osm_info] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('osm_info',array(&$this, 'sc_info'));

Shortcode PHP function:

function sc_info($atts) {
    include('osm-sc-info.php');
    return $output;
  }

Code file location:

osm/osm/osm.php

Conclusion

Now that you’ve learned how to embed the OSM OpenStreetMap Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *