Hi Omar,
If you’re still wanting to do this I modified the code a little because I needed it as well.
In the core.php file, change the function at line 477 to
protected function mapShortcodeCalled()
{
global $post;
$matches = array();
$found = false;
$this->mapShortcodeCalled = apply_filters( self::PREFIX .'mapShortcodeCalled', $this->mapShortcodeCalled ); // filter should be named map-shortcode-called, but people already using the camelcase version
if( $this->mapShortcodeCalled )
return true;
if( !$post )
return false; // 404 or other context where $post doesn't exist
// Check for shortcodes in the post's content
preg_match_all( '/'. get_shortcode_regex() .'/s', $post->post_content, $matches );
if( !is_array( $matches ) || !array_key_exists( 2, $matches ) )
return false;
for( $i = 0; $i < count( $matches[2] ); $i++ )
{
if( $matches[2][$i] == 'bgmp-map' )
{
$found = $i;
break;
}
}
if( $found !== false )
{
// Parse out any arguments
if( !empty( $matches[ 3 ][ $found ] ) )
{
$atts = $matches[ 3 ][ $found ];
$attributes = array();
parse_str(html_entity_decode($matches[ 3 ][ $found ]), $attributes);
foreach($attributes as $name => $val)
{
switch($name) {
case "categories":
case "Categories":
$this->mapShortcodeCategories = $val;
break;
case "centerLat":
case "CenterLat":
$this->settings->mapLatitude = $val;
break;
case "centerLong":
case "CenterLong":
$this->settings->mapLongitude = $val;
break;
case "zoom":
case "Zoom":
$this->settings->mapZoom = $val;
break;
}
}
//$this->mapShortcodeCategories = str_replace( '"', '', $matches[ 3 ][ $found ] );
//$this->mapShortcodeCategories = explode( '=', $this->mapShortcodeCategories );
//$this->mapShortcodeCategories = explode( ',', $this->mapShortcodeCategories[1] );
}
$this->mapShortcodeCategories = apply_filters( self::PREFIX .'mapShortcodeCategories', $this->mapShortcodeCategories ); // filter should be named map-shortcode-categories, but people already using camelcase version
return true;
}
else
return false;
}
Now you can use a url style shortcode:
[bgmp-map categories=gonzales¢erLat=29.50308¢erLong=-97.454649&zoom=11]
I only set variables for the categories, and latitude and longitude and zoom level. If you need to override anything else it’s pretty easy to add if you’re handy with PHP or post here and I can update the code.