Puede utilizar el Gancho oum_locations_bubble_content para manipular el contenido de las burbujas de información de las ubicaciones.
Inserte el siguiente código PHP en el functions.php de su tema:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= 'Post ID: ' . $location['post_id'];
return $content;
}, 10, 2);
Para añadir un valor de los campos por defecto edite esta línea:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= $location['post_id']; // use post_id, date, name, address, lat, lng, text, audio
return $content;
}, 10, 2);
To display the images of a location use $location[‘images’]. Pay attention that images are stored in the form of an array:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
foreach ( $location['images'] as $image_url ) {
$content .= '<img src="' . $image_url . '">';
}
return $content;
}, 10, 2);
You can also display all location images as slider. The following code will return the images in the form of an interactive gallery:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= oum_get_location_value('images', $location['post_id']); // IMPORTANT: For Open User Map older than v1.4.9 use 'image' instead of 'images'
return $content;
}, 10, 2);
And to display a value from a custom field use this code:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= oum_get_location_value('CUSTOM FIELD LABEL', $location['post_id']);
return $content;
}, 10, 2);
Cambia ETIQUETA DE CAMPO PERSONALIZADA a la nombre de su campo personalizado.
Ubicación de las banderas/informes
A continuación le mostramos cómo puede añadir un simple botón de Bandera (Eliminar ubicación) que envíe un correo electrónico con el ID de ubicación correspondiente a su bandeja de entrada:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$sendto = '[email protected]';
$subject = 'Please remove the Location with ID ' . $location['post_id'];
$content .= '<div class="oum_location_text"><a href="mailto:' . $sendto . '?subject=' . urlencode($subject) . '">Flag Location</a></div>';
return $content;
}, 10, 2);
Pista: Para eliminar el contenido existente de la burbuja añada esta línea al principio:
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content = '';
$content .= 'Post ID: ' . $location['post_id'];
return $content;
}, 10, 2);