WordPress Users added to map source to ACF version plugin
Now you can select Users as a source for the map and filter through ACF
This branch of locateandfilter_pro plugin is distributed as an addon and is not included in the pro version
demo https://demo-user.locateandfilter.com/demo-map-users/
How to used
1 First you need add User on plugin Options
2 on Post type source option choose Users
and you need activate ‘Enable ACF for filters’ option on Map settings
because taxonomy not available on Users
3 to your users will be added locateandfilter metabox option
You can setup coordinates for each users
4 Setup ACF filters, see doc
5 you need setup Navlist Templates and Tooltip template
bacause default template not support for Users
on settings Navlis and Tooltip template you can see new tags
User navigation list template
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<div class='navlist-content-user'> <div class='navlist-thumbnail-user'> <img src="|avatar_url|"> </div> <div class='navlist-user'> <div class='navlist-titles'> <div class='navlist-title'>|display_name|</div> <div class='navlist-subtitle'>|description| </div> </div> <div class='navlist--user-content'> <div class='acf_list'><strong>ACF price: </strong> |taxACF-field_648afc4b7119c---price| </div> <div class='acf_list'><strong>ACF categories: </strong> |taxACF-field_648afc747119d---categories| </div> <div class='acf_list'><strong>ACF servises: </strong> |taxACF-field_648afce57119e---servises| </div> <div class='acf_list'><strong>Servises : </strong> |user_field_648afce57119e| </div> <div class='acf_list'><strong>ACF open: </strong> |taxACF-field_648afd54711a0---open| </div> <div class='acf_list'><strong>Nickname : </strong> |nickname| </div> <div class='acf_list'><strong>First name : </strong> |first_name| </div> <div class='acf_list'><strong>Last name : </strong> |last_name| </div> <div class='acf_list'><strong>Role :</strong> |role| </div> <div class='acf_list'><strong>User login : </strong> |user_login| </div> <div class='acf_list'><strong>User email :</strong> |user_email| </div> <div class='acf_list'><strong>User url : </strong> |user_url| </div> <div class='acf_list'><strong>User registered : </strong> |user_registered| </div> </div> </div> </div> |
User Tooltip template
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<div class='navlist-content-user'> <div class='navlist-thumbnail-user'> <img src="|avatar_url|"> </div> <div class='navlist-user'> <div class='navlist-titles'> <div class='navlist-title'>|display_name|</div> <div class='navlist-subtitle'>|description| </div> </div> </div> </div> |
5 if you use ACF tag for template
and ACF filed type Select or Checkbox
these tags will only return values and not names, labes
to get user friendly values for these fields you can add a new custom tag to your theme
eg for ACF Servises (key field_648afce57119e)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Locate_And_Filter_Addon_Helper::define_custom_tags( array( 'user_field_648afce57119e' =>'user_field_648afce57119e'), 'all', getDataCallbackFn_user_field_648afce57119e_tags, 'user_field_648afce57119e' ); function getDataCallbackFn_user_field_648afce57119e_tags( $field, $id){ $html = ''; ob_start(); $field = str_replace('user_', '', $field); $acf_filed = get_field_object($field, 'user_' .$id); echo "<div class='custom_tag_acf ".$field."'>"; foreach ($acf_filed["value"] as $key => $value) { echo "<span>".$acf_filed["choices"][$value]."</span>"; } echo "</div>"; $html .= ob_get_contents(); ob_end_clean(); return $html; } |