Hi Chris,
I need to pass a post id (rather than a map id) to the mappress shortcode, so I’m using a custom shortcode below.
The problem is that the map is always displaying above my content. It doesn’t display where I put my [mastermap post_id=”1″] shortcode. The default map setting is set to not display anything, so I can’t figure out why this is happening.
Any thoughts? Maybe there is a different way to achieve what I’m trying to do?
add_shortcode( 'mastermap', 'get_map' );
function get_map( $atts ) {
global $wpdb;
$defaults = array('post_id' => '');
extract(shortcode_atts($defaults, $atts));
$value = shortcode_atts($defaults, $atts);
$p_id = $value['post_id'];
$mapid = $wpdb->get_var($wpdb->prepare("SELECT distinct mapid FROM {$wpdb->prefix}mappress_posts s WHERE postid=%s", $p_id));
echo do_shortcode('[mappress mapid="'.$mapid.'"]');
}