Support

Account

Forum Replies Created

  • Thanks John i will try this technique out! i did not even know that you can build fields with php 😀

  • You meant something like:

    function my_acf_add_local_field_groups() {
        acf_add_local_field_group(array(
            'key' => 'group_1',
            'title' => 'My Group',
            'fields' => array (
               array('key' => 'field_1', 'label' => 'Sub Title', 'name' => 'sub_title', 'type' => 'text'),
               if(is_admin()){
                    array('key' => 'field_2', 'label' => 'Sub Title Admin', 'name' => 'sub_title', 'type' => 'text')
               }
            ),
            'location' => array (
                array (
                    array (
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'post',
                    ),
                ),
            ),
        ));
    }
    add_action('acf/init', 'my_acf_add_local_field_groups');
  • That’s true but if some fields are shown on the profile pages you have to have a specific group that has those fields. and if some fields are shown else where you have to have a specific group for those or a’m i getting something wrong?

    ahh nice thanks for the link! will do it straight a way

  • I was a little afraid that there is no way of doing this. I think that a hook where you could hide files with php would be really nice. Because now i have to add a new Field group that only has one field in it. and if i want to create a second field that only an admin can edit i have to create a new group and a field in side that. because you can’t have a field only show in profile pages only a group of fields :/

    Is there any way that this feature could be added in the future?

  • function my_acf_load_field( $field ) {
     
        return;
    
    }
    add_filter('acf/load_field/name=acf_primary_role', 'my_acf_load_field');

    I found this solution? is this a good way to do it? Of course this code should be wrapped in a if not admin statement

Viewing 5 posts - 1 through 5 (of 5 total)