### [Exporting Custom Templates](https://wpforms.com/docs/exporting-custom-templates/)

**Published:** April 8, 2024
**Author:** David Ozokoye

**Excerpt:** Learn how to manually create and export your own form templates.

**Content:**

Would you like to manually create and export your own form templates? Custom templates enable you to build and use your own unique “starter” forms. If you tend to use many of the same fields and settings in your forms, or if you want to use the same form across multiple sites running WPForms, this can be a huge time saver.

This tutorial will show you how to create your own custom form templates from a new or existing form.

- [Creating a Form to Use as a Template](#create-form)
    - [Adding and Customizing Fields](#aioseo-adding-and-customizing-fields-14)
    - [Configuring Form Settings](#aioseo-configuring-form-settings-23)
        - [General](#aioseo-general-25)
        - [Notifications](#aioseo-notifications-31)
            - [Confirmations](#aioseo-confirmations-36)
- [Exporting Form Code to Create a Template](#export-code)
- [Adding Template Code to Your Site](#add-code)
    - [Method 1: Copying and Pasting Template Code to functions.php](#aioseo-method-1-copying-and-pasting-template-code-to-functions-php-60)
    - [Method 2: Pasting Template Code into a New PHP File and Including It in functions.php](#aioseo-method-2-pasting-template-code-into-a-new-php-file-and-including-it-in-functions-php-65)
    - [Method 3: Creating a Custom Plugin](#aioseo-method-3-creating-a-custom-plugin-72)
    - [Using Your New Custom Template](#use-template)
    - [Deleting the Original Form Template (Optional)](#delete-form)
    - [Frequently Asked Questions](#faq)

**Note:** The steps in this tutorial involve editing your site files. If you’d prefer a simpler way, see our guide on [creating custom templates](https://wpforms.com/docs/how-to-create-a-custom-form-template/) for more details.

---

First, make sure WPForms is [installed and activated](https://wpforms.com/docs/install-wpforms-plugin/) on your site. Then you can dive into the tutorial below.

## Creating a Form to Use as a Template

To begin, you’ll need a form that will later be copied to create your template. You can use an existing form or [create a new one](https://wpforms.com/docs/creating-first-form/).

When creating a new form, you can choose to either start with a blank form or use one of our existing templates and customize it.

On the Setup page, enter the name of your template in the **Name Your Form** field.

![Naming a new form to use as a template](https://wpforms.com/wp-content/uploads/2018/08/name-custom-form-template.png)This title will be visible in the template library once you add your custom template to it, so make sure it’s something descriptive but not too long.

### Adding and Customizing Fields

You can add fields to your template form by clicking on them in the panel on the left of the form builder, or by dragging and dropping them into the preview area.

![Adding a Checkboxes field to a form](https://wpforms.com/wp-content/uploads/2018/08/adding-checkboxes-field.gif)You can click on any field in the preview panel to open and customize its field options.

![Customizing field options to use in a form template](https://wpforms.com/wp-content/uploads/2018/08/customizing-field-options.png)**Note:** Looking for more guidance on setting up your template’s fields? You can learn more about all the available options in our tutorials on [choosing the right form fields](https://wpforms.com/docs/how-to-choose-the-right-form-field-for-your-forms/) and [customizing field options](https://wpforms.com/docs/how-to-customize-form-field-options/).

You may also want to consider [adding conditional logic](https://wpforms.com/docs/how-to-use-conditional-logic-with-wpforms/) to your template form or [creating a multi-column layout](https://wpforms.com/docs/how-to-create-multi-column-form-layouts-in-wpforms/). All of your changes and customizations will be carried over into your template.

### Configuring Form Settings

You can also customize your template form’s settings to configure default settings for future forms that will use this template. All changes to your settings will carry over when you export this form to use it as a template.

#### General

In your form’s General settings, you can edit your template’s title and add a description.

![Customizing the description for a custom template form](https://wpforms.com/wp-content/uploads/2018/08/adding-custom-form-template-description.png)Both of these will later be visible in the template library, so it’s a good idea to customize them. Make sure your description includes any key details for people using your template, such as its intended purpose.

Here you can also edit the submit button text, toggle anti-spam protection on or off, and [add custom CSS](https://wpforms.com/developers/how-to-add-custom-css-styles-for-wpforms/) if you wish.

#### Notifications

In your template form’s notifications settings, you can create one or more default notifications for your template.

![Customizing the default notification for a custom template](https://wpforms.com/wp-content/uploads/2018/08/customizing-template-default-notification.png)**Note:** Need help customizing your template’s notifications? Check out our tutorial on [setting up notification emails](https://wpforms.com/docs/setup-form-notification-wpforms/) for more details.

##### Confirmations

You can change your template’s default confirmation in your confirmations settings.

![Customizing the default confirmation for a new custom template](https://wpforms.com/wp-content/uploads/2018/08/customizing-template-default-confirmation.png)**Note:** Want to learn more about creating form confirmations? See our guide to [WPForms’ confirmations settings](https://wpforms.com/docs/setup-form-confirmation-wpforms/).

When you’re happy with your template, save your changes by clicking the **Save** button in the top right corner of the form builder.

![](https://wpforms.com/wp-content/uploads/2021/03/save-form.png)Then click on the **X** icon to exit the form builder.

## Exporting Form Code to Create a Template

Now that you’ve set up your template form, you can export it to add it to the template library.

First, you’ll need to get your template’s code by going to **WPForms** » **Tools** and clicking on the **Export** tab.

![Accessing the WPForms Export tools](https://wpforms.com/wp-content/uploads/2018/08/WPForms-export-tools.png)On this page, scroll down to the **Form Template Export** section, which provides a dropdown list of all of your forms. Select the form you created to use as your template and click the **Export Template** button.

![Exporting a custom form template](https://wpforms.com/wp-content/uploads/2018/08/form-template-export.png)The template code will then be generated and displayed on your screen.

![The export code for a custom template](https://wpforms.com/wp-content/uploads/2018/08/form-template-export-code.png)Copying and pasting this code to your site files will display this template in the form template library on the Setup page of the form builder.

## Adding Template Code to Your Site

We’ll discuss three methods for adding your exported template’s code to your site. For all of these options, you’ll first need to make sure you have access to your [site files](http://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-file-and-directory-structure/).

All of the following options will work for adding the template to the same site you build it on, or to another site.

### Method 1: Copying and Pasting Template Code to functions.php

If you would like the easiest and fastest solution for adding your custom template to your site, this is the way to go.

Open your site’s `functions.php` file by going to `/wp-content/themes/YOUR-THEME/functions.php` in your site’s files.

Then you can copy and paste the template code directly into `functions.php`. Save the file when you’re done.

**Note**: Keep in mind that any custom code in `functions.php` can potentially disappear if you update your theme. You can avoid this by [creating a child theme](http://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/) or using a custom plugin as described below.

### Method 2: Pasting Template Code into a New PHP File and Including It in functions.php

This method is very similar to the first one we covered, except that you will put the template code in its own file. This will help to protect it from accidental changes and keep your site’s code more organized.

If you choose this option, you will first need to open your site’s `functions.php` file in `/wp-content/themes/YOUR-THEME/functions.php`. Then paste in the following code:

```

// Add Custom Template File
include_once( get_stylesheet_directory() . '/wpforms-custom-templates.php' );
```

This tells your site to run the code in a file named `wpforms-custom-templates.php`. Next, you need to create that file. Be sure to create it in the `/wp-content/themes/YOUR-THEME/` directory (the same folder as `functions.php`).

Lastly, you’ll need to paste the template code into the `wpforms-custom-templates.php` file and save it.

**Note:** When creating your `wpforms-custom-templates.php` file, you must add `

**Categories:** Functionality, Form Templates

---

