Title: shortcode with array (map options)
Last modified: August 21, 2016

---

# shortcode with array (map options)

 *  Resolved [akinorikul](https://wordpress.org/support/users/akinorikul/)
 * (@akinorikul)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-with-array-map-options/)
 * I would like to display a map with some specific styling :
 *  `function custom_pronamic_google_maps_the_content( $content ) {
    $content .=
   pronamic_google_maps( array( ‘width’ => 955, ‘height’ => 400, ‘map_options’ =
   > array( ‘styles’ => array( (object) array( ‘stylers’ => array( (object) array(‘
   saturation’ => ‘-100’ ), ) ), ) ) ) );
 *  return $content;
    }`
 * I can find a way to write it as a shortcode, is it possible ?
 * [http://wordpress.org/plugins/pronamic-google-maps/](http://wordpress.org/plugins/pronamic-google-maps/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Leon Rowland](https://wordpress.org/support/users/zogot/)
 * (@zogot)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-with-array-map-options/#post-4450388)
 * Hello akinorukul.
 * Unfortunately the plugin doesn’t currently support setting the ‘styles’ with 
   the shortcode. Instead what you could do is write your own shortcode and put 
   the function you pasted over into that shortcode.
 * Would that be an option?
 *  Thread Starter [akinorikul](https://wordpress.org/support/users/akinorikul/)
 * (@akinorikul)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-with-array-map-options/#post-4450390)
 * Hello Leon,
    why not, I tried :
 *     ```
       function custom_pronamic_google_maps_the_content( $atts, $content=null ) {
               $content .= pronamic_google_maps( array(
                   'width'  => 955,
                   'height' => 400,
                   'map_options' => array(
       				'styles' => array(
       					(object) array(
       						'stylers' => array(
       							(object) array( 'saturation' => '-100' ),
       						)
       					),
       				)
       			)
               ) );
   
               return $content;
           }
   
           //add_filter( 'the_content', 'custom_pronamic_google_maps_the_content', 9 );
           add_shortcode( 'custom_googlemaps', 'custom_pronamic_google_maps_the_content' );
       ```
   
 * and used [custom_googlemaps] in my post but it doesn’t work.
    Am I missing something?
 *  Plugin Author [Remco Tolsma](https://wordpress.org/support/users/remcotolsma/)
 * (@remcotolsma)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-array-map-options/#post-4450418)
 * You need to set ‘echo’ argument to false:
 *     ```
       function custom_pronamic_google_maps_the_content( $atts, $content=null ) {
               $content .= pronamic_google_maps( array(
                   'echo'  => false,
                   'width'  => 955,
                   'height' => 400,
                   'map_options' => array(
       				'styles' => array(
       					(object) array(
       						'stylers' => array(
       							(object) array( 'saturation' => '-100' ),
       						)
       					),
       				)
       			)
               ) );
   
               return $content;
           }
   
           //add_filter( 'the_content', 'custom_pronamic_google_maps_the_content', 9 );
           add_shortcode( 'custom_googlemaps', 'custom_pronamic_google_maps_the_content' );
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘shortcode with array (map options)’ is closed to new replies.

 * ![](https://ps.w.org/pronamic-google-maps/assets/icon-256x256.png?rev=3194044)
 * [Pronamic Google Maps](https://wordpress.org/plugins/pronamic-google-maps/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pronamic-google-maps/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pronamic-google-maps/)
 * [Active Topics](https://wordpress.org/support/plugin/pronamic-google-maps/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pronamic-google-maps/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pronamic-google-maps/reviews/)

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 3 replies
 * 3 participants
 * Last reply from: [Remco Tolsma](https://wordpress.org/support/users/remcotolsma/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/shortcode-with-array-map-options/#post-4450418)
 * Status: resolved