Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Ian Dunn

    (@iandunn)

    Not right now, but it’s on my TODO list for a future version. I’m not sure when I’ll get to it, though.

    Thread Starter Osmarbb

    (@osmarbb)

    No problem, thanks any way ?? Great Plugin!
    https://www.ceaa.org.py/?page_id=40

    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&centerLat=29.50308&centerLong=-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.

    Hi dumdumsareyum

    I just wanted to thank you for sharing your code – I have also been hanging out for this enhancement.

    Your modification is working like a dream ??

    Cheers

    Ridgididgi

    Plugin Author Ian Dunn

    (@iandunn)

    The next version (1.7) will have support for this, and also categories within the [bgmp-list] shortcode. It’ll also support map width, height, and type (e.g., street, satellite, etc).

    I’ve got all of it written, but I’m still testing it and cleaning it up, so it’ll probably be 1-3 weeks before it’s released.

    Thread Starter Osmarbb

    (@osmarbb)

    I thank you so much! I’ll be upgrading the site shortly ??

    That’s great news about version 1.7 getting closer to release, Ian – I am really looking forward to these two enhancements ?? In the meantime, dumdumsareyum’s modification means my individual maps can now have different center points and zoom levels while I’m waiting (very patiently :-)) for version 1.7.

    Plugin Author Ian Dunn

    (@iandunn)

    Version 1.7 will support categories and other parameters in the [bgmp-map] shortcode. It’s almost ready for release, but I’d like to get some feedback and additional testing from other users. If you’re interested you can download the release candidate and give feedback.

    Plugin Author Ian Dunn

    (@iandunn)

    1.7 is available now.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Basic Google Maps Placemarks] Change the map center and zoom level in a post’ is closed to new replies.