Hi
Thanks for using the plugin
1 Add an image field with ACF in Marker
http://prntscr.com/so0du3
2 upload image to ACf in marker
http://prntscr.com/so0hnq
3 create custom tag, add to functions.php this code
see doc https://locateandfilter.monothemes.com/docs/locateandfilter-wp-plugin/developers-guide/add-new-custom-tags/
Locate_And_Filter_Addon_Helper::define_custom_tags(
array( 'project_image' =>'project_image'),
'all', getDataCallbackFn_place_tags,
'project_image'
);
function getDataCallbackFn_place_tags( $field, $id){
$html = '';
ob_start();
$project_image = get_field('project_image', $id);
echo '<a href="'.$project_image.'"><img src="'.$project_image.'" style="width:300px;">';
$html .= ob_get_contents();
ob_end_clean();
return $html;
}
4 add to tooltip this tag http://prntscr.com/so10ia
see demo https://locateandfilter.monothemes.com/demo-map-for-post-by-filter-categories-and-tags-default-left-layout/
http://prntscr.com/so126l
I hope this helps
Thanks you very much for your so quick answer.
As I’m using Oxygen builder, I have no functions.php
And when I use your code as a plugin I get an error in the first line.
Do you know why it doesn’t actually work in this case ?
Thank again
add to your custom plugin this code, it works for me
add_action('plugins_loaded', 'init_tags_for_locate_and_filter_plugin');
function init_tags_for_locate_and_filter_plugin() {
if ( class_exists('Locate_And_Filter_Addon_Helper') ) {
new Locate_And_Filter_Addon_Helper;
Locate_And_Filter_Addon_Helper::define_custom_tags(
array( 'project_image' =>'project_image'),
'all', getDataCallbackFn_place_tags,
'project_image'
);
function getDataCallbackFn_place_tags( $field, $id){
$html = '';
ob_start();
$project_image = get_field('project_image', $id);
echo '<a href="'.$project_image.'"><img src="'.$project_image.'" style="width:300px;">';
$html .= ob_get_contents();
ob_end_clean();
return $html;
}
} else {
add_action('admin_notices', 'wc_not_loaded');
}
}
function wc_not_loaded() {
printf(
'<div class="error"><p>%s</p></div>',
__('Sorry cannot create tag because Locate_And_Filter is not loaded')
);
}
Works perfectly! Thanks for your support