WordPress.org

Ready to get started?Download WordPress

Forums

Basic Google Maps Placemarks
Markers working with Qtranslate. (2 posts)

  1. inluxc
    Member
    Posted 1 year ago #

    plugins/basic-google-maps-placemarks/core.php
    line: 994

    /**
    		 * Gets the published placemarks from the database, formats and outputs them.
    		 * @author Ian Dunn <ian@iandunn.name>
    		 * @return string JSON-encoded array
    		 */
    		public function getMapPlacemarks()
    		{
    			$placemarks = array();
    
    			$query = array(
    				'numberposts'	=> -1,
    				'post_type'		=> self::POST_TYPE,
    				'post_status'	=> 'publish'
    			);
    
    			if( isset( $this->mapShortcodeArguments[ 'categories' ] ) )
    			{
    				$query[ 'tax_query' ] = array(
    					array(
    						'taxonomy'	=> self::TAXONOMY,
    						'field'		=> 'slug',
    						'terms'		=> $this->mapShortcodeArguments[ 'categories' ]
    					)
    				);
    			}
    
    			$query = apply_filters( self::PREFIX . 'get-placemarks-query', $query );		// @todo - filter name deprecated
    			$publishedPlacemarks = get_posts( apply_filters( self::PREFIX . 'get-map-placemarks-query', $query ) );
    
    			if( $publishedPlacemarks )
    			{
    				foreach( $publishedPlacemarks as $pp )
    				{
    					$icon = wp_get_attachment_image_src( get_post_thumbnail_id( $pp->ID ) );
    					$defaultIcon = apply_filters( self::PREFIX .'default-icon', plugins_url( 'images/default-marker.png', __FILE__ ), $pp->ID );
    
    					$placemarks[] = array(
    						'title'		=> $this->qtranslate($pp->post_title),
    						'latitude'	=> get_post_meta( $pp->ID, self::PREFIX . 'latitude', true ),
    						'longitude'	=> get_post_meta( $pp->ID, self::PREFIX . 'longitude', true ),
    						'details'	=> wpautop( $this->qtranslate($pp->post_content) ),
    						'icon'		=> is_array( $icon ) ? $icon[0] : $defaultIcon,
    						'zIndex'	=> get_post_meta( $pp->ID, self::PREFIX . 'zIndex', true )
    					);
    				}
    			}
    
    			$placemarks = apply_filters( self::PREFIX . 'get-placemarks-return', $placemarks );	// @todo - filter name deprecated
    			return apply_filters( self::PREFIX . 'get-map-placemarks-return', $placemarks );
    		}
    
    		/**
    		 * Strip language translations from qtranslate module
    		 *
    		 * @author FĂșlvio Carvalhido <fcarvalhido@gmail.com>
    		 */
    		private function qtranslate($str){
    			//global _e;
    			include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    			if(is_plugin_active('qtranslate/qtranslate.php')) {
    				return __($str);
    			}else{
    				return $str;
    			}
    		}

    I hope it will be in the next release :D

    http://wordpress.org/extend/plugins/basic-google-maps-placemarks/

  2. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    Hi inlucx, you don't need to modify the plugin to achieve this. You can use the bgmp_get-map-placemarks-return filter to modify the placemarks content from a functionality plugin. That way your changes won't be overridden when you upgrade.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic