I am trying to: I need to display 3 different ctagories of address post type in a map, each category needs a specific marker, and this categories have to be filterable
I visited this URL:
I expected to see:
Instead, I got:
Dear aldo,
Yes, you can specific different icon for different markers, you can add attribute "marker_icon" in the shortocde [wpv-map-marker],
For example there are two posts in the custom types, each post has one term in category:
post1 (cat1)
post2 (cat2)
Then you can create two different icon in your website:
hidden link
hidden link
Then in shortcode [wpv-map-marker] you can specific the marker_icon as below:
[wpv-map-marker map_id='map-2' marker_id='marker-2' marker_icon="hidden link type='category' format='slug'].png" address='....][/wpv-map-marker]
More help:
https://toolset.com/documentation/views-shortcodes/#wpv-post-taxonomy
description:
Output the taxonomy for the current post.
I've not understand this shortcode...
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
[wpv-map-render map_id="map-2" map_width="100%" map_height="450px" single_zoom="2" scrollwheel="off" double_click_zoom="off"]
<wpv-loop>
[wpv-map-marker map_id='map-2' marker_id='headquarters' marker_icon='hidden link' marker_field='wpcf-address'][wpv-post-body view_template='None'][/wpv-map-marker]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Can you explain more, this is my loop output and with this i see in the map all the markers with the same icon, but I need to have the differrent icons by category
In custom type I have 3 categories: headquarters, Companies, Agents
so i need to display in a single map this post with 3 different icons, plus I need to filter by a dropdown menu like screenshot
thanks
Aldo
See below live website:
hidden link
user/pass: xgren/111111
posts which has term "cat1" display marker icon "heady_link1.gif" in the map
posts which has term "cat2" display marker icon "heady_link2.gif" in the map
Here are the detail steps:
1) Dashboard-> Views-> Settings-> Compatibility
in option "Functions inside conditional evaluations" add wordpress function has_term
2) Create view, in the view's loop use map marker shortcode like this:
hidden link
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-address' marker_icon='[wpv-post-body view_template="marker image"]'][wpv-post-link][/wpv-map-marker]
3) in the content template use [wpv-conditional] shortcode to the term of current post, and output correspond marker icon:
[wpv-conditional if="(has_term('cat1', 'category', null) eq '1')"]<em><u>hidden link</u></em>
[wpv-conditional if="(has_term('cat2', 'category', null) eq '1')"]<em><u>hidden link</u></em>
hidden link
Hope it help
I've followed your guide but still the markers are the same for the different categories
see my screenshot with my settings
I don't understand where is the mistake.
thanks again
Aldo
It seems you are using different views,
1) Screenshot:
hidden link
This is a view which should output the result as the test site:
hidden link
see the post list under the google map
2) but screenshot:
hidden link
It is outputting result from another view.
Please check it, if you need more assistance for it, please duplicate same problem in a test site, and fill below private detail box with login details. thanks
Thanks for the details, in your case is using custom taxonomy "dealer-category", so the codes of content template should be:
[wpv-conditional if="(has_term('headquarters', 'category', null) eq '1')"]<em><u>hidden link</u></em>
[wpv-conditional if="(has_term('group-companies', 'category', null) eq '1')"]<em><u>hidden link</u></em>
Please test again, check if it is what you need
Thanks for your help but still someting is wrong, please check with the admin / pwd
Aldo
Sorry, in your case is using custom taxonomy "dealer-category", you will need to replace "category" with "dealer-category",
so the codes of content template should be:
[wpv-conditional if="(has_term('headquarters', 'dealer-category', null) eq '1')"]<em><u>hidden link</u></em>
[wpv-conditional if="(has_term('group-companies', 'dealer-category', null) eq '1')"]<em><u>hidden link</u></em>
Great!!! now is working...
Now I need to add a filter by a dropdown menu for area custom taxonomy and a button to select the dealer taxonomy like this screenshot:
For the dropdown I'm fine with this code:
<div class="rel_pro">
[wpml-string context="wpv-views"]
<p>Select area: </p>
[/wpml-string] [wpv-control taxonomy="area" url_param="wpvarea" type="select" default_label="All"]</div>
I need to set the "button section" with the icons.
thanks
Aldo
You can setup the parameter filter form by following our document:
Parametric search – Letting Visitors Filter Content
https://toolset.com/documentation/user-guides/front-page-filters/
And since your original question has been resolved, I suggest you create new thread for new question, it will help other users to find the answers.
Thank you for solution Luo Yang!
I have a doubt. I wanted to differentiate by Posts Fields instead of category. It's possible?
I have a Post Field that works by radio button.
Field slug: tipo-de-unidade
Options:
- type1
- type2
Something like this :
[wpv-conditional if="(has_term('type1', 'tipo-de-unidade', null) eq '1')"]<em><u>hidden link</u></em>
[wpv-conditional if="(has_term('type2', 'tipo-de-unidade', null) eq '1')"]<em><u>hidden link</u></em>
Thanks!