Support

Account

Home Forums Feature Requests Feature Request: Flexible Content – Show a definable field's value as title

Solving

Feature Request: Flexible Content – Show a definable field's value as title

  • Hi,

    Let’s assume the following exemplary setup:

    I need to manage many ‘Persons’ Layouts in a flexible content field.

    if the ‘Person’ box is closed (folded), the title only says ‘Person’. It would be nice if one of the ‘Person’ fields (i.e. ‘Name’) could be set as the ‘Person’ title. The box would then say something like: ‘Person: Firstname Lastname’ and could be easily identified in closed (folded) state.

  • Hi @mariowhat-digital,

    Thanks for the request.

    This feature has already been implemented in the plugin and you can set the layout title using this filter: https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/

    This was added in v 5.3.6 🙂

    I hope this info helps.

  • I’ve implemented this as outlined in the link but when you collapse an item the title loses the sub_field data until you refresh the page again. Screengrab attached and my code below:

    
    function my_acf_flexible_content_layout_title( $title, $field, $layout, $i ) {
    
      if( $text = get_sub_field('anchor_name') ) {
        $title = '<strong>' . $text . '</strong> - <em>'.$title.'</em>';
      }  
    
      return $title; 
    }
    add_filter('acf/fields/flexible_content/layout_title/name=content_blocks', 'my_acf_flexible_content_layout_title', 10, 4);
    

    This is problematic since users will likely collapse as they go and then re-order.

    Any idea why this is happening?

  • Hi @ndimatteo

    I believe the plugin author has created a fix for this issue in version 5.4.8. Could you please update it and see if it fixes the issue?

    Thanks 🙂

  • Hey James,

    That did the trick! Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Feature Request: Flexible Content – Show a definable field's value as title’ is closed to new replies.