How to echo field name as CSS class in Advanced Custom Fields (ACF) ? | WP Help Guide
Advanced Custom Field (ACF) is a free WordPress plugin to create custom field meta box in Wordpress without having to code anything. If you have used ACF, you know how easy it is to use and create custom meta boxes in WordPress. If you want to echo an ACF field value then you use use following code: If you want to get the value of an ACF field as a variable then use following code: But, what if you want to get the name of the field: In that case, you have to use the ACF function called: get_sub_field_object To echo a field name as class in the theme use following code: where 'col_left' is your field name. This will output: Hope that works for you.
Post to Tumblr