Reply To: Map generated from custom fields / display in template don't show

Home Forums MapPress Support Map generated from custom fields / display in template don't show Reply To: Map generated from custom fields / display in template don't show

#13802
fanchrobin
Participant

Hi, yes a map is generated for each post. It is generated from custom fields, not for each post in the Back-office, but in the template called when posts are displayed.
eg. I have a template for posts called content.php
In the WordPress Back-office : To add a new post, you have to fill a form. Each field of the form is a custom field.
For the address, you have 3 custom fields : street address, postal code, city.
In the Front-end : When a post is displayed, it calls content.php
in content.php, there are some lines of code which generates the map from the custom field values. In order to correctly display the map, I’ve had to concatenate the 3 custom fields relating to the address.

I tried to generate the maps with the Geocoding settings, but it’s not working for me: I guess it’s because of the address-related custom fields. I tried with the custom field ‘street address’ in address line 1, ‘postal code’ in address line 2, and ‘city’ in address line 3.

Nonetheless the geocoding does not work, but with this method I also cannot control the exact place where the map displays in the post. The ‘before content’ or ‘after content’ options don’t fit with the other parts of the post’s content.