Results 1 to 2 of 2

Thread: Create a Google Map using custom fields

  1. #1
    Thread Starter
    cbcrook's Avatar
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Create a Google Map using custom fields

    My website: http://www.maconlocalmarket.com/

    is a local website that only accepts ads in one city and only at certain locations.

    As such, I am trying to create a Google map using a custom field that has a dropdown box.

    I created a custom field with cp_preferred_vendor_address and modified the sidebar-gmap.php to include the city and state as shown below the line.

    However, this leads to the map disappearing in the post.

    I did try a test form where I left in cp_street (Called Address in my form) as a non required option and left it blank and the map works fine.

    To verify my findings, on my website I created two separate posts that are the same except that one had the cp_street option and the field was left blank.

    http://www.maconlocalmarket.com/ads/adfgsdfg/

    http://www.maconlocalmarket.com/ads/dafg/

    Can anyone tell me why this is happening, and how I can get my maps to work without putting in an empty field? I think it will cause confusion on the site if I require my visitors to leave a field blank...



    <div id="gmap" class="mapblock">

    <?php
    // check to see if ad is legacy or not and then assemble the map address
    if ( get_post_meta($post->ID, 'location', true) )
    $make_address = get_post_meta($post->ID, 'location', true);
    else
    $make_address = get_post_meta($post->ID, 'cp_preferred_vendor_address', true) . '&nbsp;' . "Macon" . '&nbsp;' . "Georgia" . '&nbsp;';

    $coordinates = cp_get_geocode( $post->ID );
    ?>

    - - - Updated - - -

    Also, I am not sure if this belongs in the mods section or not, since it deals with the basic GMaps feature, but it is different from how the feature was intended. Please feel free to move the thread as needed.

  2. #2
    Veteran barukar's Avatar
    Join Date
    Sep 2010
    Location
    Brasil, São Paulo, SP
    Posts
    6,785
    Thanks
    186
    Thanked 742 Times in 623 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    -------------------------------------------------------------------------------------------
    Projects: ClassiNoiva - Classimóveis - vocênoenem - i50 - Clube DETRAN

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create new custom fields
    By pedro_alfaiate in forum Vantage General Discussion (Legacy)
    Replies: 12
    Last Post: December 17th, 2017, 06:33 PM
  2. Which File Processes The HTML Markup of The Create Listing Custom Fields?
    By edwin in forum Vantage General Discussion (Legacy)
    Replies: 4
    Last Post: January 21st, 2013, 05:55 AM
  3. Profile custom fields to create diferent rates
    By romstutz in forum Advanced Custom Fields
    Replies: 3
    Last Post: November 9th, 2012, 01:03 PM
  4. create custom fields
    By luehning in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: June 28th, 2011, 02:52 PM
  5. Can't create custom fields
    By ldopi in forum Report ClassiPress Bugs
    Replies: 6
    Last Post: February 2nd, 2011, 04:08 AM