Custom-field-value < – > automatic icon

Home Forums MapPress Support Custom-field-value < – > automatic icon

This topic contains 3 replies, has 2 voices, and was last updated by  Chris 1 year ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #16907

    Avantart
    Participant

    Hi Chris,

    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,

    Connie

    #16908

    Chris
    Keymaster

    Hi,

    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’.

    #16909

    Avantart
    Participant

    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, Connie

    #16910

    Chris
    Keymaster

    Hi,

    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.

    #16917

    Avantart
    Participant

    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,

    Connie

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.