Site logo

[Resolved] No formatting possible with ACF WYSIWYG field

Home Forums Support [Resolved] No formatting possible with ACF WYSIWYG field

Home Forums Support No formatting possible with ACF WYSIWYG field

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2432639
    Björn

    Hi.

    I am using Advanced Custom Fields to display Customer Feedback in a Custom Post Type through a WYSIWYG editor. Unfortunately all paragraphs are merged and no formatting is displayed on the front end.

    My Custom Post Type has a custom layout through an element. In the element I am trying to display the respective customer feedback via ACF.

    Thanks in advance!

    #2432815
    David
    Staff
    Customer Support

    Hi there,

    are you using GenerateBlocks Pro ? As that has ACF Support for its Dynamic data

    #2432843
    Björn

    No, only free GenerateBlocks version, unfortunately.

    #2432970
    David
    Staff
    Customer Support

    Ok, so instead you would need to create a Shortcode using a PHP Snippet like this:

    
    add_shortcode('customer_feedback', function(){
        ob_start();
        if( get_field('your_custom_field_name') ):
            the_field('your_custom_field_name');
        endif;
        return ob_get_clean();
    });

    Change the your_custom_field_name to match yours.
    Then you can use the shortcode [customer_feedback] in your element content.

    #2433074
    Björn

    As always great support. Works like a charm!

    Thank you!

    #2433080
    David
    Staff
    Customer Support

    Glad to hear that!

    #2536640
    Simon

    Hello

    While trying to integrate ACF fields of type Wysiwyg in a GeneratePress content Template (GP Element of type Block), I meet the same problem as Björn.
    The paragraphs are not rendered (other html tags are).

    I tried the method of creating a shortcode.
    But it doesn’t work for me.

    Can you help me?

    https://drive.google.com/file/d/1k79FgvCax67_NCtwaKrsVp6i87XxJ3d7/view?usp=sharing

    Thanks

    #2536698
    Simon

    Edit:
    Well, Everything went back to normal with the Pro version of GenerateBlocks that I intended to buy anyway.

    Sorry for the untimely relaunch of this topic.

    Best regards

    #2536711
    David
    Staff
    Customer Support

    Hi there,

    this is more a consequence of either ACF, WordPress or the TinyMCE editor. So debugging that can be a pain.

    In ACF the_field function has 2 additional params:

    https://www.advancedcustomfields.com/resources/the_field/

    Including the $format which says whether or not to show the HTML format.

    Try setting that param to true in the shortcode eg.:

    
    add_shortcode('show_wysiwyg', function(){
        ob_start();
        if( get_field('your_field') ):
            the_field('your_field', false, true );
        endif;
        return ob_get_clean();
    });

    If that doesn’t work then do you have the TinyMCE plugin installed as that may be interfering with what it returns?

    #2536740
    David
    Staff
    Customer Support

    Glad to hear that it is working !!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.