Support

Account

Forum Replies Created

  • Thanks @James.
    I believe that as long as core code remains the same – field structure/class/prefix – there is no need to add code for each field.
    Also, it works for repeater fields too. Something that I needed.
    If I can be of any assistance, let me know.

  • I know it’s been a year but, in case this can help someone, this seems to do it, at least for me:

    
    add_action('acf/render_field_settings', 'hidelabel_render_field_settings');
    function hidelabel_render_field_settings( $field ) {	
    	acf_render_field_setting( $field, array(
    		'label'			=> __('Hide Label?'),
    		'instructions'	=> '',
    		'name'			=> 'hide_label',
    		'type'			=> 'true_false',
    		'ui'			=> 1,
    	), true);	
    }
    
    add_filter('acf/prepare_field', 'hidelabel_prepare_field');
    function hidelabel_prepare_field( $field )
    {
    	if ($field['hide_label'])
    		echo '
    		<style type="text/css">
    			.acf-field-', substr($field['key'],6),' > .acf-label {display: none;}
    		</style>';
    	return $field;
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)