Support

Account

Home Forums Feature Requests Flexible Content Titles Reply To: Flexible Content Titles

  • I know that this is an older thread, but you can’t use the layout name in this filter, it only works with field name or field key (belonging to the flex field) https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/.
    You can have it dependent on the existing title. For example:

    
    add_filter('acf/fields/flexible_content/layout_title/name=content_rows', 'my_acf_fields_flexible_content_layout_title', 10, 4);
    function my_acf_fields_flexible_content_layout_title( $title, $field, $layout, $i ) {
      // load text sub field
      if( $title == 'Two Column') {
        $text = get_sub_field('title');
        if ($text) {
          $title .= '<span> - ' . $text . '</span>';
        }
      }
      // return
      return $title;
    }