Title: [Plugin: Comprehensive Google Map Plugin] How to Style with JSON Code
Last modified: August 20, 2016

---

# [Plugin: Comprehensive Google Map Plugin] How to Style with JSON Code

 *  [ShermanOne](https://wordpress.org/support/users/shermanone/)
 * (@shermanone)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-comprehensive-google-map-plugin-how-to-style-with-json-code/)
 * The Google Maps API provides the possibility to style a map.
    Where and how do
   I setup the code I get from
 * [http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html](http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html)
 * For example here:
    [http://tips4php.net/2010/06/style-your-google-maps-with-json/](http://tips4php.net/2010/06/style-your-google-maps-with-json/)
 * it says how to add the code to html, but how about PHP?
 * best regards
 * [http://wordpress.org/extend/plugins/comprehensive-google-map-plugin/](http://wordpress.org/extend/plugins/comprehensive-google-map-plugin/)

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

 *  [lukehm](https://wordpress.org/support/users/lukehm/)
 * (@lukehm)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-comprehensive-google-map-plugin-how-to-style-with-json-code/#post-2993080)
 * I wondered this too.
    I know hoe to do this with my own map. Is it possible to
   style the map created by CGMP by adding some inline js? Many Thanks
 *  [mckeene](https://wordpress.org/support/users/mckeene/)
 * (@mckeene)
 * [13 years ago](https://wordpress.org/support/topic/plugin-comprehensive-google-map-plugin-how-to-style-with-json-code/#post-2993111)
 * Did you ever figure out how this was done?
 *  [macambulance](https://wordpress.org/support/users/macambulance/)
 * (@macambulance)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-comprehensive-google-map-plugin-how-to-style-with-json-code/#post-2993120)
 * I finally figured this one out, you have to add to the json-string parameter 
   in the object, and tell the javascript file to pick up that style from the object.
   Here’s what I did, you might be able to suggest better code :
    1. In the cmgp plugin directory > short code.php > line #74 : $map_data_properties[‘
       styles’] = *your style info here as a json formatted string*
    2. In the cmgp plugin directory > assets > js > cgmp.framework.min.js file > line#
       2
 *  1.  change : `b.maptypecontrol,panControl:"true"===b.pancontrol,zoomControl:"true"
       ===b.zoomcontrol,scaleControl:"true"===b.scalecontrol,scrollwheel:"true"===b.
       scrollwheelcontrol,streetViewControl:"true"===b.streetviewcontrol,tilt:"true"
       ===b.tiltfourtyfive?45:null,draggable:"true"===b.draggable,overviewMapControl:!
       0,overviewMapControlOptions:{opened:!1}});"true"===b.showpanoramio&&p.buildPanoramioLayer(
       b.panoramiouid);"true"===b.showbike&&p.buildBikeLayer();"true"===b.showtraffic&&
       p.buildTrafficLayer();null!=b.kml&&`
    2. to : `b.maptypecontrol,panControl:"true"===b.pancontrol,zoomControl:"true"==
       =b.zoomcontrol,scaleControl:"true"===b.scalecontrol,scrollwheel:"true"===b.scrollwheelcontrol,
       streetViewControl:"true"===b.streetviewcontrol,tilt:"true"===b.tiltfourtyfive?
       45:null,styles:b.styles,draggable:"true"===b.draggable,overviewMapControl:!0,
       overviewMapControlOptions:{opened:!1}});"true"===b.showpanoramio&&p.buildPanoramioLayer(
       b.panoramiouid);"true"===b.showbike&&p.buildBikeLayer();"true"===b.showtraffic&&
       p.buildTrafficLayer();null!=b.kml&&`
 * I keep the google style info in my theme options as a json formatted string, 
   then use `json_decode($string)` to load that into the map_data_properties array
 * Hope that makes sense/helps!
 *  [macambulance](https://wordpress.org/support/users/macambulance/)
 * (@macambulance)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-comprehensive-google-map-plugin-how-to-style-with-json-code/#post-2993121)
 * note the `styles:b.styles` to line #2 in the js frameworks file, if you don’t
   want to play spot-the-difference between the two js code samples

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

The topic ‘[Plugin: Comprehensive Google Map Plugin] How to Style with JSON Code’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/comprehensive-google-map-plugin_e2e4ef.
   svg)
 * [Comprehensive Google Map Plugin](https://wordpress.org/plugins/comprehensive-google-map-plugin/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/comprehensive-google-map-plugin/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/comprehensive-google-map-plugin/)
 * [Active Topics](https://wordpress.org/support/plugin/comprehensive-google-map-plugin/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/comprehensive-google-map-plugin/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/comprehensive-google-map-plugin/reviews/)

## Tags

 * [json](https://wordpress.org/support/topic-tag/json/)
 * [style](https://wordpress.org/support/topic-tag/style/)

 * 4 replies
 * 4 participants
 * Last reply from: [macambulance](https://wordpress.org/support/users/macambulance/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-comprehensive-google-map-plugin-how-to-style-with-json-code/#post-2993121)
 * Status: not resolved