Tell us what you are trying to do?
I am trying to build an interface which will allow users to choose a different "topic" to show content (Organisations) on a map using different marker icons. I currently have two taxonomies with custom image fields added which hold the marker icons for each term within each taxonomy. I would essentially like to add some buttons which let users select a topic, resulting in the marker icons changing on the map and those icons to be based of the term values for each post.
I do actually have it working, but I am wondering if there is a more elegant solution which needs to be less hard-coded.
What I have implemented at the moment is:
- created a CPT - "Organisation"
- added two custom taxonomies with custom image fields ("Organisation type" and "Geographical scope") - these share the same image field - "map-marker-icon"
- added some "Organisations" with values selected for the custom taxonomies mentioned above
- created a view which presents the map and the posts
- created two additional views which return the URL of the image from the desired taxonomy. These share a common custom template with the sole output being:
[types termmeta='map-marker-icon' size='thumbnail' url='true'][/types]
- inside a custom template, added the [map_marker] object and added a conditional which evaluates a URL parameter ("marker") and returns the desired view name into the marker_icon parameter of the [map_marker]. This looks like:
[wpv-conditional if="( '[wpv-search-term param='marker']' eq 'map-marker-organisation-type' )"]
marker_icon="[wpv-view name='map-marker-organisation-type']"
[/wpv-conditional]
- I then aim to add a custom button somewhere to control this functionality.
This works, but what I would like to do is pass the "marker" URL parameter directly to [wpv-view], more like:
marker_icon="[wpv-view name='[wpv-search-term param='marker']']"
This would remove the need to hard-code the view names in the conditional and just return the value directly to the view name, but this doesn't work.
When I turn on debug mode on [map_marker], it just says "Marker source unknown".
I have also tried setting up a custom shortcode to return the view name, but this ends up with the same result.
Is this possible and/or is there a better way to do this? This doesn't need to be from a URL parameter of course, definitely open to other options!
Is there any documentation that you are following?
Lots of different bits.
Is there a similar example that we can see?
Not that I have seen.
What is the link to your site?
This is extremely developmental, so excuse the horrible layout and icons - just working on functionality for now. The latest page is:
hidden link
but to get the different marker views:
hidden link
and
hidden link
As you can see, I am also going to be adding filters. I am aware that I probably also need to split this out into multiple views on a custom layout, but I will get to that.