Home › Forums › Add-ons › Flexible Content Field › Shortcode inside flexible field › Reply To: Shortcode inside flexible field
I’m using Contact 7 forms in this way. I have a flexible content field I’m using as a page builder.
I added my shortcode to a text field schedule_a_demo_form
like this;
[contact-form-7 id="xxx" title="Schedule A Demo"]
In my template I do this;
$scheduleADemoForm = get_sub_field('schedule_a_demo_form');
echo do_shortcode($scheduleADemoForm);
Also, to prevent users from altering the shortcode in the text field I added a class admin-readonly
to the wrapper and in my admin-styles.css
added this style;
.admin-readonly {
pointer-events: none;
}
This prevents them from accessing the input (unless they know how to use developer tools that is 🙂 )
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.