/** * Map a shortcode in a post. * * @param mixed $atts - shortcode attributes */ function shortcode_map($atts = '') { global $post; // No feeds if (is_feed()) { return; } // Try to protect against calls to do_shortcode() in the post editor... if (is_admin()) { return; } $atts = $this->scrub_atts($atts); // Determine what to show $mapid = isset($atts['mapid']) ? $atts['mapid'] : null; if ($mapid) { // Show map by mapid $map = Mappress_Map::get($mapid); } else { // Get the first map attached to the post $maps = Mappress_Map::get_post_map_list($post->ID); $map = isset($maps[0]) ? $maps[0] : false; } if (!$map) { return; } return $map->display($atts); }
/** * Post edit * * @param mixed $post */ function meta_box($post) { global $post; $maps = Mappress_Map::get_post_map_list($post->ID); Mappress_Map::edit($maps, $post->ID); }