1. Home
  2. Knowledge Base
  3. Customization
  4. Modify location data before rendering (map & list view, eg. customize marker icon)

Modify location data before rendering (map & list view, eg. customize marker icon)

You can customize the data for each location before it is getting rendered on the map or in the list. This can be useful if you want to display specific marker icons for certain locations.

PHP
add_filter('oum_location_data', function ( $location_data, $post_id ) {

  // Example: Change marker icon based on custom logic
  if ( $post_id == 123 ) {
    $location_data['icon'] = 'https://example.com/custom-marker.png';
  }

  // You can modify any property of $location_data:
  // - icon: marker icon URL (works for map markers and list view)
  // - title, lat, lng, zoom, types, post_id, address, text, image, audio, video, custom_fields, votes, etc.
  // - content: plain text for the map marker search only (not the popup HTML). Full bubble markup is built
  //   on the server and can be changed with the oum_location_bubble_content filter (or oum_location_bubble_image).

  return $location_data;
}, 10, 2);
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support

EN