This should work:
<?php
add_filter('acf/location/rule_types', 'acf_location_rules_types');
function acf_location_rules_types($choices)
{
$choices['Menu']['menu_level'] = 'Nível do Menu';
return $choices;
}
add_filter('acf/location/rule_values/menu_level', 'acf_location_rule_values_level');
function acf_location_rule_values_level($choices)
{
$choices[0] = '0';
$choices[1] = '1';
return $choices;
}
add_filter('acf/location/rule_match/menu_level', 'acf_location_rule_match_level', 10, 4);
function acf_location_rule_match_level($match, $rule, $options, $field_group)
{
if ($rule['operator'] == "==") {
$match = ($options['nav_menu_item_depth'] == $rule['value']);
}
return $match;
}
John, your answer was amazing! thank you
aaaaaah.. it’s my own call to google maps that is broken. 🙂
Nice. Do I need to load the script by hand? Cause in the admin screen the widget works without problem.
BTW, I upgraded the plugin to 4.3.8, and the map doesn’t work in the public form. Does someone have any clue of what is happenning?