- This topic has 9 replies, 3 voices, and was last updated 3 years, 1 month ago by
David.
-
AuthorPosts
-
November 25, 2022 at 3:24 am #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!
November 25, 2022 at 4:51 am #2432815David
StaffCustomer SupportHi there,
are you using GenerateBlocks Pro ? As that has ACF Support for its Dynamic data
November 25, 2022 at 5:06 am #2432843Björn
No, only free GenerateBlocks version, unfortunately.
November 25, 2022 at 6:18 am #2432970David
StaffCustomer SupportOk, 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_nameto match yours.
Then you can use the shortcode[customer_feedback]in your element content.November 25, 2022 at 7:11 am #2433074Björn
As always great support. Works like a charm!
Thank you!
November 25, 2022 at 7:13 am #2433080David
StaffCustomer SupportGlad to hear that!
February 17, 2023 at 4:37 am #2536640Simon
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
February 17, 2023 at 5:49 am #2536698Simon
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
February 17, 2023 at 5:54 am #2536711David
StaffCustomer SupportHi there,
this is more a consequence of either ACF, WordPress or the TinyMCE editor. So debugging that can be a pain.
In ACF
the_fieldfunction has 2 additional params:https://www.advancedcustomfields.com/resources/the_field/
Including the
$formatwhich 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?
February 17, 2023 at 6:19 am #2536740David
StaffCustomer SupportGlad to hear that it is working !!
-
AuthorPosts
- You must be logged in to reply to this topic.