Fitoussi / geo-my-wp

Advanced mapping and geolocation plugin for Wordpress
https://geomywp.com
36 stars 22 forks source link

Map Shortcode Embed 3.0b2 #57

Closed TechRemarker closed 6 years ago

TechRemarker commented 6 years ago

In the latest stable version 2.0 version, the Map Embed short code appears to work correctly. As I'm using the Posts Locator add-on. And when on one of those posts it shows a template that includes

<?php echo do_shortcode('[gmw_single_location map="1" map_width="100%" map_height="128px" additional_info="0" directions="0"]'); ?>

In 3.0 this no longer works. From what I can see "gmw_single_location" should now be "gmw map".

Updated to, "<?php echo do_shortcode('[gmw map="1" map_width="100%" map_height="128px" additional_info="0" directions="0"]'); ?>" and no map appears. Even tried simply "<?php echo do_shortcode('[gmw map="1"]'); ?>" but nothing.

Are there additional steps in 3.0 to have the maps work on posts? I do see their is a page load results tab with a map dropdown (that I didn't have to customize for 2.0) but for 3.0 tried setting that to shortcode but doesn't seem to have an affect on the above. Thanks!

Fitoussi commented 6 years ago

The single Location shortcode/widget is still there. It used to be enabled by default with GEO my WP, now it is its own Single Location core add-on.

Please navigate to GEO my WP extensions page ( dashboard-> GEO my WP -> Extensions ) and verify that the Single location add-on is enabled.

The "Page Load Results" tab serves a different purpose. You can use it to defined the behavior of the Posts Locator form when the page first loads.

TechRemarker commented 6 years ago

Thanks so much, I assumed it was core functionality since it was enabled by default in the previous version. Enabling the plugin in 3.0 greatly helps and now the map is showing. However, in v2, using:

<?php echo do_shortcode('[gmw_single_location map="1" map_width="100%" map_height="128px" additional_info="0" directions="0"]'); ?>

would show just a 128x128 map. In version 3.0 b2, it shows the map, but also a title, address, distance, directions link, etc. Do additional_info="0" directions="0" no longer work in 3.0? In v2 I believe there was a page that showed all the various variables gmw_single_location supported but can't seem to find that listing in v3.0 as the form usage table just shows the basic.

I'll keep experimenting in the mean time, thank you.

Fitoussi commented 6 years ago

You are welcome Chris.

Now there is the new "elements" shortcode attribute which allows you to set which elements to display and their order.

<?php echo do_shortcode('[gmw_single_location elements="map" map_width="100%" map_height="128px"]'); ?>

Will display the map only.

<?php echo do_shortcode('[gmw_single_location elements="title,map,directions_link" map_width="100%" map_height="128px"]'); ?>

Will display the title, the map and the get directions link.

Fitoussi commented 6 years ago

You can see this page for more details.

TechRemarker commented 6 years ago

Awesome, that worked perfectly. I updated to, "<?php echo do_shortcode('[gmw_single_location elements="map" map_width="100%" map_height="128px"]'); ?>". Overall all of these changes make things much cleaner. Great job.

Fitoussi commented 6 years ago

Perfect!

Thank you for the feedback.