Multiple Fields for Address Custom Field

Home Forums MapPress Support Multiple Fields for Address Custom Field

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9092
    blrboston
    Participant

    Hi Chris,

    I was just wondering if there is a way to set multiple custom fields for the address in MapPress Pro.  I don’t necessarily need to do it from the GUI and can modify the PHP instead but my address scheme is set up with a custom field for:  “Address Line 1” which would be “123 Example Street” and “Address Line 2” which would be “Boston, MA 02116”.  For other parts of the template, this separation is necessary.  Thanks for any help – great plugin!

    #9095
    Chris
    Keymaster

    Hi, that feature is coming in the next release. I was hoping to have that available today but I’m still working on it, so I can only say it will be available “soon”. If you can code PHP, you can use the ‘save_post’ action to just concatenate the source fields into the ‘address’ field. You can take a look at the file ‘mappress_pro.php’ for some examples.

    #10131
    metropoliscreative
    Participant

    Hi Chris,

    I made this post last time as well (under blrboston) but just bought the 3 pack again for another website project.  It seems that I still cannot choose the MapPress address from multiple custom fields as described above.  I took a look at what you mentioned in regard to save_posts and am still trying to work through it, but it is a bit complex for my understanding.  Have you implemented a less obvious way to do this in MapPress? If not, could you please give a bit better perspective on how to go about it?

    This feature is even more important for the client I’m working with now and any help would be very greatly appreciated!

    #10132
    metropoliscreative
    Participant

    hi Chris,

    As a follow-up, I think I ALMOST have it working through this function which I placed in functions.php.  The only issue now is: the custom field “Address Complete” will be filled with the meta from the other boxes if it is empty but will not overwrite if there is something already there!  If I can figure out that one thing I think this should do it.  Any idea?

     

    // AUTO COMBINE CUSTOM FIELDS ON LOCATIONS
    add_action('publish_locations', 'add_custom_field_automatically');
    add_action('update_locations', 'add_custom_field_automatically');
    function add_custom_field_automatically($post_ID) {
    global $wpdb;
    get_post_custom($GLOBALS['post']->ID);
    $add1 = get_post_meta( $GLOBALS['post']->ID, 'Address Line 1', true );
    $add2 = get_post_meta( $GLOBALS['post']->ID, 'Address Line 2', true );
    $addcity = get_post_meta( $GLOBALS['post']->ID, 'City', true );
    $addzip = get_post_meta( $GLOBALS['post']->ID, 'Zip Code', true );
    $addcomp= $add1 . ' ' . $add2 . ' ' . $addcity . ' ' . $addzip;
    if(!wp_is_post_revision($post_ID)) {
    add_post_meta($post_ID, 'Address Complete', $addcomp, false) or update_post_meta($post_ID, 'Address Complete', $addcomp, false);
    }
    }

    #10155
    Chris
    Keymaster

    Hi, that feature is already in the beta versions, check out the release notes and see here for info about how to download:

    http://mappresspro.com/betas

    Hopefully, they’ll do what you want without custom code?

    #10267
    metropoliscreative
    Participant

    Hi Chris,

    Added the beta and it seems to be working! One thing to note was that the “loading” circle was appearing below the map even once the map was finished loading but I just changed the css to make it disappear. It could have been some kind of conflict on my site too I suppose. Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.