Beispiel #1
0
 function shortcode_wpgeo_map($atts, $content = null)
 {
     global $post, $wpgeo;
     $wp_geo_options = get_option('wp_geo_options');
     $show_post_map = apply_filters('wpgeo_show_post_map', $wp_geo_options['show_post_map'], $post->ID);
     if ($wpgeo->show_maps() && !is_feed() && $show_post_map != 'TOP' && $show_post_map != 'BOTTOM' && $wpgeo->checkGoogleAPIKey()) {
         $atts = wp_parse_args($atts, array('width' => $wp_geo_options['default_map_width'], 'height' => $wp_geo_options['default_map_height'], 'align' => 'none', 'lat' => null, 'long' => null, 'type' => 'G_NORMAL_MAP', 'escape' => false));
         // Escape?
         if ($atts['escape'] == 'true') {
             return '[wpgeo_map]';
         }
         // To Do: Add in lon/lat check and output map if needed
         $styles = array();
         if (in_array(strtolower($atts['align']), array('left', 'right'))) {
             $styles['float'] = strtolower($atts['align']);
         }
         return get_wpgeo_post_map($post->ID, array('width' => $atts['width'], 'height' => $atts['height'], 'styles' => $styles, 'content' => $content));
     }
     return '';
 }
Beispiel #2
0
/**
 * WP Geo Post Map
 * Outputs the HTML for a post map.
 *
 * @param int $post_id (optional) Post ID.
 */
function wpgeo_post_map($post_id = null)
{
    echo get_wpgeo_post_map($post_id);
}