Search code examples
wordpressgravity-forms-plugin

Hide Wordpress page contents when on Gravity Form inner pages


I have a multi-page gravity form. I've echoed it using do_shortcode within the theme template.

I have content on the same page below the gravity form (which resides inside the wp editor (the_content() wrapped in a div with its own class) ).

Is there a way for me to hide this content on page 2 or later of the gravity form? I would still like it to appear on page 1 of the gf form.


Solution

  • Here was the final code that worked for me:

    <script type="text/javascript">
        jQuery(document).bind('gform_post_render', function(event, form_id, current_page){
            jQuery('.page-content').toggle(current_page == 1);
        });
    </script>
    

    I placed this in header.php