Support » Plugin: Pronamic Google Maps » [Plugin: Pronamic Google Maps] Google maps to front end

  • Resolved jnhghy


    Is there a way to move the options that we have in backend to the front end? I have a custom post type “Ad” so I have the google maps options in wp-admin -> ads -> add new my users will post ads to my site the thing is they won’t have access to the backend, I have a template that allows them to set the post details (meta data) so I’m wondering what are the steps that I need to take to give the users the option to set the Long and Lat for theyer posts?
    From what I read the plugin functions works in the loop so can you give me some directions? on how to prepare the template for this changes?
    Thank you for your trouble!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Remco Tolsma


    The Pronamic Google Maps plugin saves the GEO data in WordPress post meta fields. You could extend your frontend form with an latitude and longitude field and save this information in the meta data fields of the created custom ‘ad’ post.

    $id = wp_insert_post(...);
    update_post_meta($id, '_pronamic_google_maps_active', 'true');
    update_post_meta($id, '_pronamic_google_maps_latitude', $_POST['latitude']);
    update_post_meta($id, '_pronamic_google_maps_longitude', $_POST['longitude']);

    Thanks for your respons,
    The thing is, that this is why I need the plugin to save the latitude and longitude using the plugin (as it does in the backend) so the user in the first step form gives me the street address, the thing is that this street address is not 100% accurate so in the 2nd step I want him to confirm his exact location, I will show him a map with a marker that is dragable, I don’t need to show him the latitude and the longitude but I need him to move the marker to the right place and I will save that latitude and longitude. hope you understand my ideea now :).

    In the front end I made some changes in the loop:
    I had a look in the code of the plugin and I tried to include it in the front page by adding:
    <?php include (ABSPATH . 'wp-content/plugins/pronamic-google-maps/views/meta-box.php'); ?>
    and this brought all the html that I need but the map is not showing – I inspected the html and I don’t have the javascript that needs to fill the “pgm-canvas” <div>.
    I’ll try to find the javascript and include that one too,
    Any help will be appreciated!

    Me again,
    I’m tring to give you as much info as I can 🙂
    after some tries and some changes, I added to my frontpage adimn.js file:
    this is the file that locates all the html elements so it can change the value of them, but I hit an error in admin.js ln: 376 “Uncaught ReferenceError: google is not defined”
    the file is working perfect in backend so I guess I need to include a nother file, any ideeas?

    Plugin Author Remco Tolsma


    I don’t think it’s a very good idea to include files intended for the backend into the frontend. The chance that this will cause problems after plugin updates is quite high. I think it is better to write some custom code for your idea. The Google Developers page for Google Maps is an good place to start: After you have collected all the required information you easily save it into the meta fields i mentioned earlier.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Pronamic Google Maps] Google maps to front end’ is closed to new replies.