Hello
I have a simple issue I think but can't find the solution.
I am building a simple Companies directory. Each company can have multiple offices, and each office has its own adress.
I have created a custom post type named Companies.
I have created custom fields, attached to the Companies post type:
- Company name (slug : company-name)
- Office adress (which is a repeater field, adress type, slug : office-address)
I created sample test data.
Company 1
- Office adress 1 : Paris, France
- Office adress 2 : London, UK
- Office adress 3 : New York, US
Company 2
- Office adress 1 : Dallas, US
- Office adress 2 : Berlin, DE
- Office adress 3 : Madrid, ES
I have managed to display the office locations on a map.
My problem :
I would like to display the 'company-name' and the 'office-adress' values from the custom fields when I hover on a marker.
From what I understand, the marker_title attribute manages what is displayed when you hover on a map marker.
If I let the marker_title attribute empty, by default, it displays the post-title.
I have tried including a reference to the custom field :
[types field='office-address'][/types]
but this returns me all the office adresses of the repeater field for one company.
I would like the hover info box to just display the info specific to the marker. How can I do this?
For example, when I hover a marker on the map, I would like to display:
Company 2
Madrid, ES
Here is the simple code
Here is the simple code for displaying info for a single company. I have put question marks where I'm stuck.
[wpv-map-render map_id="map-1"]
[wpv-map-marker
map_id="map-1"
marker_id="marker-1"
marker_title="?????"
marker_field="wpcf-office-address"]
[/wpv-map-marker]
Thanks for your help.
Xavier