Advanced Custom Fields filter instructions – AFC

Filter Instructions

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
27
28
29
30
31
function my_acf_load_field( $field ) {
     
    //var_dump($field);
    global $post;
    $this_val = get_post_meta($post->ID,'access_code',true);
    $this_link = get_the_permalink($post->ID);
    $full_link = "$this_link?access_code=".$this_val;
    $field['instructions'] = "<a href='$full_link' target='_blank'>$full_link</a>";
    //$field['value'] = 'dammm'.$field['value'];
 
    return $field;
     
}
 
add_filter('acf/load_field/name=access_code', 'my_acf_load_field');
 
 
function support_menu_choices( $field ) {
      
    $data[] = "Main";
    $field['choices'] = $data;
    $menus = get_terms('nav_menu');
    foreach($menus as $menu){
      $data[] = $menu->name;
    }
    $field['choices'] = $data;
    return $field;
      
}
  
add_filter('acf/load_field/name=support_menu', 'support_menu_choices');
Comments