• Resolved New_WP

    (@baxter89)


    Hello,
    When I use the Text Area or Wysiwig Editor fields in ACF, I manage to display the text using the dynamic field, but the text is continuous, the line breaks do not work in both cases.
    Thanks

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

    (@edge22)

    Hi there,

    Our Pro version has deeper ACF integration that includes line breaks/WYSIWYG.

    If you’d like to do this in the free version, you’ll need to add a function like this:

    add_filter( 'generateblocks_dynamic_content_output', function( $output, $attributes ) {
    	if ( isset( $attributes['dynamicContentType'] ) && 'post-meta' === $attributes['dynamicContentType'] ) {
    		$id = isset( $attributes['postId'] ) ? $attributes['postId'] : get_the_ID();
    		$custom_field = get_field_object( $attributes['metaFieldName'], $id );
     
    		if ( isset( $custom_field['type'] ) && 'wysiwyg' === $custom_field['type'] ) {
    			$output = wpautop( $output );
    		}
    	}
     
    	return $output;
    }, 10, 2 );

    Hope this helps!

    Thread Starter New_WP

    (@baxter89)

    Hello,
    Thank you for the code, I did the test locally after installing a child theme, I added the code in fonction.php and it crashes the site.
    
    For information I use CPT UI and ACF
    
    See screenshot.
    
    <a href="https://snipboard.io/Ln6uQY.jpg" rel="noopener" target="_blank">Image</a>
    
    Thanks
    • This reply was modified 3 years, 6 months ago by New_WP.
    Plugin Author Tom

    (@edge22)

    Hmm, that doesn’t look right, can you double-check to make sure you added the entire code snippet that I shared?

    The fact the error is saying unexpected attributs when we don’t use attributs anywhere in the code leads me to believe something may have been pasted incorrectly.

    Let me know 🙂

    Thread Starter New_WP

    (@baxter89)

    it works, I must have selected the entire code incorrectly.
    Thanks

    Plugin Author Tom

    (@edge22)

    Glad I could help! 🙂

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

The topic ‘Text Area’ is closed to new replies.