Support

Account

Home Forums Feature Requests Flexible content blocks – friendly/custom collapsed name Reply To: Flexible content blocks – friendly/custom collapsed name

  • One idea to automate, for each layout you can start with a field labeled “Admin Title” and name it as “layout_title”, then you use this function on your theme functions.php.

    
    function my_layout_title($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;
    }
    
    add_filter('acf/fields/flexible_content/layout_title', 'my_layout_title'), 10, 4);