customizing POI when map generated by custom fields

Home Forums MapPress Support customizing POI when map generated by custom fields

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13871
    fanchrobin
    Participant

    Hello,
    I create maps in my posts from a custom field. I’d like to automatically customize the body and the icon of the POI (i.e the content of the marker’s popup window). I guess I should use the POI filters functions, but I don’t exactly how to. Do I have to add_filter in the functions.php ? Could you please give me an example of the right syntax ?
    Thank you,

    #13874
    Chris
    Keymaster

    Hi,

    For the body you’ll need to modify template file map_poi.php, which is much like editing a WordPress template file. For the icons you’ll need to use a filter ‘mappress_poi_iconid’:
    http://codex.wordpress.org/Function_Reference/add_filter

    Here’s a sample filter based on two categories. You will need an update to 2.40.8 before using it – email me for the update:

    
    function myiconid($iconid, $poi) {
    	if ($poi->postid) {
    		if (has_category('cata', $poi->postid))
    			return 'blue-dot';
    		if (has_category ('catb', $poi->postid))
    			return 'purple-dot';
    	}
    	return $iconid;
    }
    
    add_filter('mappress_poi_iconid', 'myiconid', 10, 2);
    
    #13877
    fanchrobin
    Participant

    Hi Chris, Thank you for your answer. I am using v2.40.7 PRO. I have just sent you an email.
    Regards,

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.