Vous pouvez utiliser le crochet oum_locations_bubble_content pour manipuler le contenu des bulles d'information des lieux.
Insérez le code PHP suivant dans le fichier functions.php de votre thème :
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content .= 'Post ID: ' . $location['post_id'];
return $content;
}, 10, 2);Pour ajouter une valeur à partir des champs par défaut, modifiez cette ligne :
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);
Pour afficher les images d'un lieu, utilisez $location['images']. Attention, les images sont stockées sous la forme d'un tableau :
add_filter('oum_location_bubble_content', function ( $content, $location ) {
foreach ( $location['images'] as $image_url ) {
$content .= '<img src="' . $image_url . '">';
}
return $content;
}, 10, 2);
Vous pouvez également afficher toutes les images de l'emplacement sous la forme d'une barre de défilement. Le code suivant renvoie les images sous la forme d'une galerie interactive :
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);
Et pour afficher une valeur provenant d'un champ personnalisé, utilisez ce 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);
Changer ÉTIQUETTE DE CHAMP PERSONNALISÉ à la nom de votre champ personnalisé.
Emplacements des drapeaux/rapports
Voici comment vous pouvez ajouter un simple bouton de drapeau (Supprimer l'emplacement) qui envoie un courriel avec l'ID de l'emplacement correspondant dans votre boîte de réception :
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);
Indice : Pour supprimer le contenu existant de la bulle, ajoutez d'abord cette ligne :
add_filter('oum_location_bubble_content', function ( $content, $location ) {
// extend or change content
$content = '';
$content .= 'Post ID: ' . $location['post_id'];
return $content;
}, 10, 2);