Bug when generating field via Code Solution Question
-
Version of the plugin: 1.2.2
I’m trying to generate a simple field via code. In my
functions.php
I’m doing the following stuff:simple_fields_register_field_group ( 'my_test', array( 'name' => 'Test', 'description' => 'This is a test', 'repeatable' => 1, 'fields' => array( array( 'slug' => 'location', 'name' => 'Location', 'description' => '', 'type' => 'googlemaps' ) ) ));
When I do so everything works fine but using the simple field in a blogpost doesn’t show a map. This is because of line 180 and 181 in the file
simple-fields-map-extension.php
which are$options["defaultMapTypeId"], $options["defaultZoomLevel"],
A working solution is
isset($options["defaultMapTypeId"]) ? $options["defaultMapTypeId"] : "HYBRID", isset($options["defaultZoomLevel"]) ? $options["defaultZoomLevel"] : 10,
where I’ve taken the default values from your code.
Another problem is, that there is no default pointer when generating via code like I do. I think the reason is the same as above because the values do not exist and therefore it is not possible to show a default marker. Can you have a look at it?
I also have an additional question that belongs to this topic. When generating the simple field via code how do I attach my own values like the default position, zoom level, etc.?Can you give an example because I’ve found nothing on your website.
Thanks in advance for answering the questions/bugfixing and also for the great plugin in general. Very good work! 🙂
http://wordpress.org/extend/plugins/simple-fields-map-extension/
- The topic ‘Bug when generating field via Code Solution Question’ is closed to new replies.