Support

Account

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 🙂 )