• Resolved theshae

    (@theshae)


    How do you create the admin title field? So that the row has a label that is identified by a field name?

Viewing 1 replies (of 1 total)
  • Plugin Author Edir Pedro

    (@edir)

    The instructions are here:
    https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/

    In my themes I use this trick, a field named “layout_title” and this hook to get its value.

    
    add_filter('acf/fields/flexible_content/layout_title', function($title, $field, $layout, $i) {
    	if($value = get_sub_field('layout_title')) {
    		return $value;
    	} else {
    		foreach($layout['sub_fields'] as $sub) {
    			if($sub['name'] == 'layout_title') {
    				$key = $sub['key'];
    				if(array_key_exists($i, $field['value']) && $value = $field['value'][$i][$key])
    					return $value;
    			}
    		}
    	}
    	return $title;
    }, 10, 4);
    
Viewing 1 replies (of 1 total)
  • The topic ‘Admin Title Field’ is closed to new replies.