Using template tags
with OSM wordpress plugin
Preperation
Syntax to add template tags to your theme
- – - – - – - – - – - – - – - – - – - Preperation - – - – - – - – - – - – – - – - – - -
1.) Follow the OSM plugin installation instructions to prepare your blog for adding a map with your track/route.
2.) Add geolocations to your posts by Customfields
3.)Modify your WordPress themet
- – - Syntax to add template tags to your theme – - -
There are two functions which can be integrated as template tag:
A simple one:
function OSM_displayOpenStreetMap( $a_width, // the width of the map $a_height, // the hight of the map $a_zoom, // zoomlevel of the map $a_type) // type of the map
And a advanced one with some more arguments:
function OSM_displayOpenStreetMapExt( $a_width, // the width of the map: > 0 $a_height, // the height of the map: > 0 $a_zoom, // zoomlevel of the map: 1...17 $a_type, // type of the map: Osmarender, Mapnik, CycleMap, All $a_control, // wich controls are added: No, scaleline,scale,mouseposition $a_marker_name, // choose one of the markers shown in the plugin settings $a_marker_height, // osm-marker: 0; own marker > 0 $a_marker_width, // osm-marker: 0; own marker > 0 $a_marker_text, // add the name of the customfeld for the markerinfo $a_ov_map) // zoomlevel if you want a overviewmap: 0...17
The WordPress Theme of Fotomobil.at has got this modification in the index.php:
<div>
<?php the_content(__('(more...)')); ?>
<?php OSM_displayOpenStreetMapExt(
"600", // sime width as the photos in this theme
"180", // the height of the map
"5", // the zoomlevel
"Osmarender", // just one map
"No", // without any control button
"wpttemp-yellow.png", // use this standard osm-marker
0, // since it is a standard marker we need no size
0, // since it is a standard marker we need no size
"", // no customfields are used for popup marker
"13");?> // the zoomlevel of the overviewmap
</div>
Since the geolocation of this post is Beijing this map is shown – check other cities …:
Note: If you want to use your own marker:
- copy your marker into your uploads-folder (do not copy it into the plugins/osm folder!)
- use markeraddress like this to get to uploads folder: “../../../uploads/MyMarker.png”
- – - – - – - – - – - – - – - – - – - BACK to plugin page - – - – - – - – - – - – - – - – – - -
