How to Add Location Fields to Post Types Like Blog and Community Articles
Link: https://support.brilliantdirectories.com/support/solutions/articles/12000095504
In this article, we will be going over the steps on how to add location and map fields to post types like blog and community articles.
Editing the Form
The first step is to navigate to Toolbox >> Form Manager and click Customize or Edit on the preferred feature form. In the example below, we used the Blog Article:
Next, add 4 new form fields in the preferred place:
These 4 new fields should look like the following:
1) Location Map widget
Type of Field: Custom HTML
Field Label: [widget=Bootstrap Theme - Form - Member Google Location]
Database Variable: not important
2) Latitude Field
Type of Field: Hidden Field
Field Label: blank
Database Variable: lat
3) Longitude Field
Type of Field: Hidden Field
Field Label: blank
Database Variable: lon
4) Address Field
Type of Field: Textarea - Paragraph
Field Label: %%%location_label%%%
Database Variable: post_location
Addtl. Field CSS Class: form-control
Save changes and the location fields will start appearing when publishing/editing the post in the member dashboard area:
Front End Display
Once the information is saved and the Bootstrap Theme - Module - Post Location Map widget is added to the sidebar, the map will display in the details page of the post:
Using the Members Location for Posts
If the post form does not include location fields (lat, lon, etc.), there is a system-level setting called override_post_location
that can automatically use the member’s geocoded location for the post.
Important Notes About This Setting:
This is a Super Admin-only setting and is not accessible from your admin panel.
If enabled, and the post form does not contain lat/lon fields, the system will automatically assign the member’s geocoded values (lat, lon, country, state) to the post.
This setting does not populate the
post_location
string used by the location map widget. Therefore, a map or location may not display on the post details page unless the proper fields are present in the form.If the form does include lat/lon fields, this setting is ignored.
This setting was originally created to ease the transition to location-based post search and is not currently being expanded.
If you'd like to test this setting or have it enabled or disabled, please contact the Brilliant Directories support team.
Set to ON to save the lat and lon (geocode) of a member with their post if the post's form does not have lat and lon fields. Set to OFF to only save a lat and lon for a post if the fields exist in the post's form.