/ Published in: PHP
The awesome Geo Mashup Plugin for WordPress allows for auto-embedding a map showing the location of the Post, Page etc via Shortcode or adding a line of PHP into the Theme file/s.
The code below, added as a Plugin, will make a map appear at the end of each Post when a Post has Geo data (i.e. will automatically show on Posts when Geo data is defined in the Post).
To use:
1. Save the code below in a file called geo-map-end-post.php
2. Add the file to the /wp-content/plugins directory on your Webhost
3. Activate the new Plugin
The code below, added as a Plugin, will make a map appear at the end of each Post when a Post has Geo data (i.e. will automatically show on Posts when Geo data is defined in the Post).
To use:
1. Save the code below in a file called geo-map-end-post.php
2. Add the file to the /wp-content/plugins directory on your Webhost
3. Activate the new Plugin
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* Plugin Name: Geo Map to end of Post Plugin URI: http://everyaustralia.com/map-of-photos/ Description: Adds a Map to the end of each Post showing the location per the Geo Mashup Plugin. Version: 1.00 Author: Gary Eckstein Author URI: http://eckstein.id.au License: GPL version 3 */ add_filter('the_content','end_post_content'); function end_post_content($content) { if (is_single()){ $content=$content.GeoMashup::map(); } return $content; } ?>