wp2print includes a built-in contact form that you can add to any page or post with the shortcode below. You do not need a separate contact form plugin.
[wp2print_contact_form]
When a customer submits the form, wp2print emails the message to your site, with the customer's address set as the Reply-To. You can reply straight from your email program. The form is protected against spam by a hidden honeypot field and, when you turn it on, by Google reCaptcha.
The contact form is available in wp2print version 4.0.1 and later.
[wp2print_contact_form]. In the block editor, use a Shortcode block. In SiteOrigin Page Builder, use a text or editor widget.The form shows these fields:
| Field | Required | Notes |
|---|---|---|
| Name | Yes | At least 2 characters |
| Yes | Must be a valid email address. Used as the Reply-To address | |
| Phone | No | Can be hidden with show_phone="false" |
| Subject | Yes | Can be made optional with require_subject="false" |
| Message | Yes | At least 10 characters |
If a field is missing or invalid, the form is shown again with the customer's entries kept and the problem fields highlighted in red. After a successful send, the form is replaced by a confirmation message. Refreshing the page does not send the message a second time.
All options are optional. Without any options, the form sends to the WordPress Administration Email Address (Settings >> General).
| Option | Default | Description |
|---|---|---|
email_to |
Site admin email | One or more recipient email addresses, separated by commas |
subject_prefix |
(Your Site Name) |
Text placed before the subject of each email, so you can filter or recognize contact form messages |
show_phone |
true |
Set to false to hide the Phone field |
require_subject |
true |
Set to false to make the Subject field optional. If the customer leaves it blank, the subject becomes "Website contact form" |
success_message |
Thank you! Your message was sent successfully. | Message shown after the form is sent |
submit_label |
Send Message | Text of the submit button |
The recipient address is read from the page itself when the form is submitted, so visitors cannot change where messages are sent.
Send messages to two addresses and hide the Phone field:
[wp2print_contact_form email_to="sales@example.com, info@example.com" show_phone="false"]
Make the subject optional and change the button and confirmation text:
[wp2print_contact_form require_subject="false" submit_label="Contact Us" success_message="Thanks, we will get back to you within one business day."]
Use a custom subject prefix:
[wp2print_contact_form subject_prefix="[Website] "]
Use only one contact form per page. If a page contains more than one
[wp2print_contact_form]shortcode, the options of the first one are used when sending.
Each message arrives as a plain-text email:
email_to address(es)The body contains the customer's name, email, phone (if entered), subject and message, followed by the address of the page the form was sent from.
The email is sent with the standard WordPress mail function, so it uses whatever SMTP or email delivery plugin your site is already set up with. If messages do not arrive, check your site's email delivery settings and your spam folder.
The form contains a hidden field that real visitors never see. Bots that fill in every field are shown the normal confirmation message, but no email is sent. This needs no setup.
If Use reCaptcha is turned on in the reCaptcha tab of wp2print >> Settings, the contact form uses it automatically:
If the reCaptcha check fails, the message is not sent and the customer is asked to try again. See Google reCaptcha for how to set up your reCaptcha keys.
The form comes with simple built-in styling: full-width fields, a blue submit button, and green or red notices. To adjust the look, add CSS in Appearance >> Customize >> Additional CSS using these classes:
| Class | Element |
|---|---|
.wp2print-contact-form |
Wrapper around the whole form |
.wp2print-cf-field |
Each field (label and input) |
.wp2print-cf-field.has-error |
A field with an error |
.wp2print-cf-msg |
Error text under a field |
.wp2print-cf-success |
Confirmation message after sending |
.wp2print-cf-error |
General error message at the top of the form |
.wp2print-cf-actions button |
Submit button |
For example, to change the button color:
.wp2print-cf-actions button { background: #c31f1a; }
.wp2print-cf-actions button:hover { background: #8a1612; }
All labels and messages of the form use the wp2print text domain, so you can change or translate them with Loco Translate, the same way as other wp2print text. The button text and confirmation message can also be changed directly with the submit_label and success_message options.