Multiple contact pages with different emails

If you find this tweak helpful:


Tweaking Elegant Themes involves creating a child theme and editing PHP and CSS files within a text editor. If you have never done this you may want to read our guide on creating a child theme. All tweaks are written with the assumption that you have a default installation of your theme.  Any tweaks or changes you may have previously made to your theme could affect the outcome of the tweaks on this site. All tweaks should be tested before applying to a live site. 

20% Discount!!!
Divi WordPress Theme

Elegant Themes include really nice contact page templates with a built-in captcha. The problem is when you want to have more than one contact page; maybe one for each author. This simple tweak will let you add as many contact pages as you like with separate emails for each page.


Locate the page-contact.php file in /themes/foxy/

Make an exact copy of this file in /themes/foxy-child/

Change it to whatever name you want. Ex: "page-contact2.php" or "page-contact-john.php"

In the newly named contact page, locate this code near line 3:

Template Name: Contact Page

Change it to this:

Template Name: Johns Contact Page

You can put whatever you want here. When you create this page in WordPress, this is the name you will select under Page Attributes->Template.

Now locate this code near line 52 in the same file:

if ( ! $et_contact_error && isset( $_POST['_wpnonce-et-contact-form-submitted'] ) && wp_verify_nonce( $_POST['_wpnonce-et-contact-form-submitted'], 'et-contact-form-submit' ) ) {
$et_email_to = ( isset($et_ptemplate_settings['et_email_to']) && !empty($et_ptemplate_settings['et_email_to']) ) ? $et_ptemplate_settings['et_email_to'] : get_site_option('admin_email');

Change it to this:

if ( ! $et_contact_error && isset( $_POST['_wpnonce-et-contact-form-submitted'] ) && wp_verify_nonce( $_POST['_wpnonce-et-contact-form-submitted'], 'et-contact-form-submit' ) ) {
$et_email_to = '';

Replace with the email address you want to send the completed form to. Now when you create your contact page, just make sure you select the template you created in your child theme in the first step. You can repeat these steps as many times as you want to create as many contact pages as you need.

Post a Reply

Your email address will not be published. Required fields are marked *