• Is it possible to replace the Layout Label or add a custom label that can help an author name each content group when editing post? For instance, I am entering resources into a post and I have fields for name and URL in each layout. When I look at the long list of shortened up layouts, I see a bunch of items that look all the same that say Resource. I have to expand them to see which is which.

    Is there something I’m missing that I can do or is this something you can do to update the plugin?

    Thanks for the awesome plugin!

    Jerrad

    https://www.ads-software.com/plugins/acf-fold-flexible-content/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author urre

    (@urre)

    Hi!

    Not right now, but a good idea and maybe looking in to it for upcoming versions!

    Thanks

    Thread Starter Jerrad

    (@jjgleim)

    Thanks for considering the idea. Will watch for updates.

    I’m looking to do the same thing. I’ll report back here if I come up with anything. Or let me if anyone has a short term workaround.

    I have the same issue and am looking for the same thing, the ability to give meaningful labels to all my ACF content sections.

    Ok, so I gave this a quick shot. I actually edited the acf plugin, not this plugin.

    First, create a field “layout_label” for each flexible content layout. Enter a custom label.

    Then, in advanced-custom-fields-pro/pro/fields/flexible-content.php, around line 357, add:

    <?php
    $layout_txt_label = ' ';
    
    foreach( $layout['sub_fields'] as $sub_field ) {
    
    	if ( $sub_field['name'] == 'layout_label' ) {
    
    		// add value
    		if( isset($value[ $sub_field['key'] ]) ) {
    			// this is a normal value
    			$sub_field['value'] = $value[ $sub_field['key'] ];
    		} elseif( isset($sub_field['default_value']) ) {
    			// no value, but this sub field has a default value
    			$sub_field['value'] = $sub_field['default_value'];
    		}
    
    		if ( $sub_field['value'] ) {
    			$layout_txt_label .= $sub_field['value'];
    		} else {
    			$layout_txt_label = 'Block';
    		}
    	}
    }
    ?>

    Then, change this line:

    <span class="fc-layout-order"><?php echo $order; ?></span> <?php echo $layout['label']; ?>

    to

    <span class="acf-fc-layout-txt-label"><b><?php echo $layout_txt_label; ?></b> </span>
    <span class="fc-layout-order"><?php echo $order; ?></span>

    I removed the default ACF layout label and gave it a generic term Block (just my preference).

    This works with or without the ACF Fold Flexible Content plugin.

    I’m posting this here in case someone wants to use this as is (will be overridden by acf plugin update) and/or take it to the next level and create a plugin or independent piece of code for functions.php. I couldn’t figure that out immediately.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Possible to replace label with a custom label when editing a post?’ is closed to new replies.