You can use the following shortcode to display a newsletter subscription form in your post, page, or text widget.
By default, Noptin applies basic CSS styles to your form fields. If the applied styles conflict with your theme styles, use the shortcode below instead.
You can pass the id of an existing form to the shortcode, and Noptin will display that form instead of the default form.
The above shortcode will display the form with ID 8875. On my site, the following form will be displayed.
If you provide a form ID that does NOT exist, the shortcode will display nothing.
If you’re displaying an existing form and you pass in one of the below attributes to the shortcode, the passed attribute will override the relevant setting that you set in the form builder.
When someone submits your newsletter sign-up form, Noptin will display the appropriate confirmation message depending on the result of the submission.
The example confirmation message below is shown when someone successfully submits the form.
These confirmation messages can be changed using the following shortcode attributes.
|invalid_email||Please provide a valid email address.|
|error||Oops. Something went wrong. Please try again later.|
|required_field_missing||Please fill in all the required fields.|
|accept_terms||Please accept the terms and conditions first.|
|already_subscribed||You are already subscribed to the newsletter, thank you!|
|updated||Thank you, your details have been updated.|
|success||Thanks for subscribing to the newsletter.|
[noptin success="Custom subscribe message"]
Noptin allows you to redirect subscribers to any URL after they submit your form successfully. This is useful, for example, if you want them to show them a custom thank you page.
To do this, pass a URL to the “redirect” attribute as shown below.
The “fields” attribute allows you to set which custom fields should show up on the form, and in which order they will show up.
The below shortcode…
… will display a form similar to the one you see below.
Do not use field labels search as First Name, Email Address, etc. Instead, pass in the field keys.
By default, Noptin displays each form field on a single line.
If your form only contains an email address field, you can change it to display the email address field and subscribe button on a single line.
To do this, set the “template” attribute to “condensed” as shown below.
This will display a form such as the one below.
Below are other shortcode attributes that you can set.
|labels||Hide or show field labels|
|wrap||Set which HTML element should be used to wrap form fields|
|html_id||Set the HTML ID of the Form|
|html_name||Set the HTML name of the Form|
|html_class||Set the HTML class of the form|
|acceptance||Display “terms of service” acceptance checkbox|
|submit||Change the text of the submit button|