Support

Account

Home Forums Backend Issues (wp-admin) Display contact form 7 shortcode in front end

Helping

Display contact form 7 shortcode in front end

  • HI sorry for the bad English…

    I would like to display the contact form 7 shortcode dynamic on the theme. I already add a Textarea in woocommerce Here my code:

    $enquiry_form_settings[] = array ( 
          'id'   => 'we_enquiry_form_textarea',
          'name' => __( 'Add Contact Form 7 Shortcodes', 'we-extra-extension' ),
          'type' => 'textarea',
          'css'  => 'min-height:200px',
          'placeholder' => 'Add Contact Form 7 Enquiry Form Shortcodes',
          'label' => __('Custom Contact Form 7 Shortcode', 'extra-extension')
    
        );

    Textarea working perfectly But I am facing a problem to display contact form 7 shortcode, please someone helps me

    Here display code :

    function demo_text () {
    
    if ( get_option ('enquiry_form_textarea') && get_option ( 'enquiry_form_textarea')){
             
        echo do_shortcode( ['cform_shortcode']);  
    
       }
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'demo_text' );

    Thanks all

  • See this page about format value filters, it has an example of using shortcode in fields other than wysiwyg fields https://www.advancedcustomfields.com/resources/acf-format_value/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.