Tagged: Custom fields with custom icons
August 9, 2016 at 1:24 am #16907
I created the custom_field “status” with the values 1,2 or 3
I created another custom field “hauptquartier” for the geocoding “adress line 1”
Mashups with the pages where the custom field “hauptquartier” is used, are generated.
Now I want to set automatic icons, f.e.
status = 1 => red.png
status = 2 => yellow.png
status = 3 => green.png
Unfortunately I cannot define this in the MapPressPro-Settings, the “key-value pair” is not listing “custom field” in the key-select.
Do I have to add something to the functions.php?
What would that be?
Thanks in advance,
ConnieAugust 9, 2016 at 1:30 am #16908
For automatic icons there is no custom field selection, it’s based on taxonomies.
However, for automatic map generation, you can pick a custom field for the icon. Go to the ‘geocoding fields’ section in the MapPress settings. Where you have set ‘address line 1’, you can also set a custom field for ‘icon’.
To regenerate those automatic maps (for example, if you change the icon field), you can re-publish the posts. From the WordPress posts section use ‘bulk actions’ and then ‘edit’, and then ‘publish’.August 9, 2016 at 2:42 am #16909
Chris, thank you, but that is not exactly what I need.
In the geocoding fields, I can only set one icon for that field, but this field has 3 states and I need a different state for each value
I know how I can create this output:
1 mashup with all objects with the status “finished” (status = 3)
1 mashup with all objects with the status “in progress” (status = 2)
1 mashup with all objects with the status “scheduled” (status = 1)
But I need a mashup with ALL objects, and each shows the status-relevant icon ;=(
how to do that?
Cheers, ConnieAugust 9, 2016 at 2:50 am #16910
The geocoding field setting takes a custom field name – not an icon name. So the icon can be different for each post – just vary the value stored in that custom field for each post. For example, post ‘A’ can have a green icon and post ‘B’ can have a blue one, by placing the values ‘green-dot’ or ‘blue-dot’ in the custom field in each post.
A more flexible solution is to use the automatic icons, but in that case you must assign your posts to a taxonomy (category, tags, etc.).
If neither of those work for your site, and you know PHP, then you can code a custom routine using the filter ‘mappress_poi_iconid’. There’s an example in the documentation.August 11, 2016 at 3:12 am #16917
Thank you Chris, for your assistance.
Now I use a taxonomy, and the icons are defined in the automatic icons settings as the values of that taxonomy shine up there.
It’s a great functionality and I learned a lot!
Have a nice day,
You must be logged in to reply to this topic.