Title: Multi-step slider doesn&#8217;t work with shortcode
Last modified: November 11, 2020

---

# Multi-step slider doesn’t work with shortcode

 *  Resolved [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/)
 * Hi,
    I’m adding the contact form shortcode with a function on my functions.php
   file. The problem is that the form slider doesn’t work if I do that way, it only
   work if I add the shortcode into a page or widget.
 * Is it possible to do it this way?
 * Thanks

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/page/2/?output_format=md)

 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13648660)
 * > I’m adding the contact form shortcode with a function on my functions.php file.
 * can you share the function and filter you are using?
 *  Thread Starter [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649369)
 * Yes of course
 *     ```
       // Trigger a Modal Popup on the Click of a Menu Element
       // https://ultimate.brainstormforce.com/docs/trigger-a-modal-popup-on-the-click-of-a-menu/
       function ultimate_VC_modal_popup() {
         if (ICL_LANGUAGE_CODE == "pt-pt") {
             echo do_shortcode( '
             [ultimate_modal modal_on="custom-selector" modal_title="Localizar representante" modal_on_selector=".display-contact-popup" modal_size="small" modal_style="overlay-fade" el_class="dealer-popup" overlay_bg_opacity="80" img_size="20" close_icon_position="popup-top-right"]
             <p class="intro">De forma a podermos encontrar um representante na sua zona, preencha os campos a baixo e entraremos em contacto consigo.</p>
             [cf7form cf7key="revendedor-pt"]
             [/ultimate_modal]' );
           }
         }
       add_action('wp_footer', 'ultimate_VC_modal_popup');
       ```
   
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649441)
 * the issue may be with the embedding of the cf7 shortcode within the other shortcode…
 * Have you tried simply: `echo do_shortcode('[cf7form cf7key="revendedor-pt"]');`?
 *  Thread Starter [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649452)
 * Hi,
    I didn’t try it but I need to have that way, because the contact form needs
   to be showed inside a modal box and the other shortcode is to do that
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649599)
 * > I didn’t try it but I need to have that way,
 * please try first, and let me know what you get
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649629)
 * the other possibility which it does not work is because you might be hooking 
   it too late on ‘wp_footer’. Does it work if you inslude the wrapping shortcode
   inside the page content?
 *  Thread Starter [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649722)
 * It works if I use the shortcode isolated, like this:
 *     ```
       function ultimate_VC_modal_popup() {
             echo do_shortcode( '[cf7form cf7key="teste"]' );
         }
       add_action('wp_footer', 'ultimate_VC_modal_popup');
       ```
   
 * But as I said I need to have the contact form inside the other shrotcode… if 
   there’s no possibility to work like that, I will forget the idea to have the 
   slider in the form
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13649888)
 * > It works if I use the shortcode isolated, like this:
 * good, so we have identified the reason.
 * >  if there’s no possibility to work like that
 * not with this approach at least for now. I may in the future look at why this
   does not work, but for now you need a different approach.
 * use the `'do_shortcode_tag'` filter introduced in v4.7 of WP,
 *     ```
       add_filter('do_shortcode_tag', 'wrap_cf7sg_form',10,3);
       function wrap_cf7sg_form($output, $tag, $attr){
         //check if this is a form shortcode.
         if('cf7form' !== $tag) return $output;
         //check if this is the right form.
         if('revendedor-pt' != $attr['cf7key'] return $output;
   
         $output = do_shortcode('
             [ultimate_modal modal_on="custom-selector" modal_title="Localizar representante" modal_on_selector=".display-contact-popup" modal_size="small" modal_style="overlay-fade" el_class="dealer-popup" overlay_bg_opacity="80" img_size="20" close_icon_position="popup-top-right"]
             <p class="intro">De forma a podermos encontrar um representante na sua zona, preencha os campos a baixo e entraremos em contacto consigo.</p>
             '.$output.'[/ultimate_modal]');
         return $output;
       }
       ```
   
 *  Thread Starter [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13653740)
 * Hi, thanks for your answer.
    When I added that code on functions file the website
   doesn’t work. My WordPress versions is 5.5.3
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13657281)
 * > the website doesn’t work.
 * did you switch on WP_DEBUG mode to see where the error is coming from?
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13657293)
 * … there is a missing bracket in the code, try
 *     ```
       add_filter('do_shortcode_tag', 'wrap_cf7sg_form',10,3);
       function wrap_cf7sg_form($output, $tag, $attr){
         //check if this is a form shortcode.
         if('cf7form' !== $tag) return $output;
         //check if this is the right form.
         if('revendedor-pt' != $attr['cf7key']) return $output;
   
         $output = do_shortcode('
             [ultimate_modal modal_on="custom-selector" modal_title="Localizar representante" modal_on_selector=".display-contact-popup" modal_size="small" modal_style="overlay-fade" el_class="dealer-popup" overlay_bg_opacity="80" img_size="20" close_icon_position="popup-top-right"]
             <p class="intro">De forma a podermos encontrar um representante na sua zona, preencha os campos a baixo e entraremos em contacto consigo.</p>
             '.$output.'[/ultimate_modal]');
         return $output;
       }
       ```
   
 *  Thread Starter [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13657757)
 * Hi, it still doesn’t work, I think it’s because that code doesn’t add the shortcode
   into the HTML, right? I need to add it somewhere, ie, in the footer
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13658021)
 * you said,
 * > t works if I use the shortcode isolated, like this:
 *     ```
       function ultimate_VC_modal_popup() {
             echo do_shortcode( '[cf7form cf7key="revendedor-pt"]' );
         }
       add_action('wp_footer', 'ultimate_VC_modal_popup');
       ```
   
 * have you tried?
 *  Thread Starter [rafaviana](https://wordpress.org/support/users/rafaviana/)
 * (@rafaviana)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13658099)
 * I, yes I tried and it works as I said. But how can I use the code you gave:
 *     ```
       add_filter('do_shortcode_tag', 'wrap_cf7sg_form',10,3);
       function wrap_cf7sg_form($output, $tag, $attr){
         //check if this is a form shortcode.
         if('cf7form' !== $tag) return $output;
         //check if this is the right form.
         if('revendedor-pt' != $attr['cf7key']) return $output;
   
         $output = do_shortcode('
             [ultimate_modal modal_on="custom-selector" modal_title="Localizar representante" modal_on_selector=".display-contact-popup" modal_size="small" modal_style="overlay-fade" el_class="dealer-popup" overlay_bg_opacity="80" img_size="20" close_icon_position="popup-top-right"]
             <p class="intro">De forma a podermos encontrar um representante na sua zona, preencha os campos a baixo e entraremos em contacto consigo.</p>
             '.$output.'[/ultimate_modal]');
         return $output;
       }
       ```
   
 * With this one:
 *     ```
       function ultimate_VC_modal_popup() {
             echo do_shortcode( '[cf7form cf7key="revendedor-pt"]' );
         }
       add_action('wp_footer', 'ultimate_VC_modal_popup');
       ```
   
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/#post-13658121)
 * you need to as both of the above codes to your functions.php file

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/page/2/?output_format=md)

The topic ‘Multi-step slider doesn’t work with shortcode’ is closed to new replies.

 * ![](https://ps.w.org/cf7-grid-layout/assets/icon-256x256.png?rev=1834229)
 * [Smart Grid-Layout Design for Contact Form 7](https://wordpress.org/plugins/cf7-grid-layout/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cf7-grid-layout/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cf7-grid-layout/)
 * [Active Topics](https://wordpress.org/support/plugin/cf7-grid-layout/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cf7-grid-layout/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cf7-grid-layout/reviews/)

 * 19 replies
 * 2 participants
 * Last reply from: [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/multi-step-slider-doesnt-work-with-shortcode/page/2/#post-13659387)
 * Status: resolved