Would you like to display a list of all forms created with WPForms on your site? Whether you want to show this list publicly or on a password-protected page, you can easily create it using a custom shortcode.
This guide will show you how to create and use a shortcode that displays all your created forms in a simple list format.
Creating the Shortcode
First, you’ll need to add this code snippet to your site. This snippet creates a shortcode that you can use on any post, page, or widget area on your site to display a list of all the forms created with WPForms.
This code works by:
- Creating a new shortcode named
wpforms_all_forms
- Retrieving all published WPForms from your site and extracting the form titles
- Displaying them in a list with line breaks between each form
Displaying a List of Forms created with WPForms
Once you’ve added the snippet above to create the shortcode, you’ll need to add this shortcode to a page, post or widget area on your site in order for the list of WPForms to display.
For our tutorial, we’re not using a page builder but WordPress Gutenberg Shortcode block to add in our shortcode to the page.
Simply add [wpforms_all_forms]
to the page and click Publish and you’ll now see a complete list of your WPForms available.
And that’s it! You’ve now created a shortcode that you can use to display a list of all your forms created with WPForms. Would you like to also create a shortcode to display a list of entries for each form? Take a look at our tutorial on How to Display Form Entries.