Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indeedably/5e3f190bd9f0191261b929cecf2ea75d to your computer and use it in GitHub Desktop.
Save indeedably/5e3f190bd9f0191261b929cecf2ea75d to your computer and use it in GitHub Desktop.
How to add Wordpress Jetpack subscription form using shortcodes.
/*
The Wordpress Jetpack plugin offers a subscription widget that can be added via shortcodes.
To enable:
1. Open the Wordpress template file (e.g. footer.php) containing the desired location of the widget.
These are located in /wp-content/themes/[YOUR THEME]/
2. Paste the code snippet below into your template file in the required location.
3. Replace the [PARAMETER n] values with your desired values.
4. Save to have the changes take effect.
*/
<?php
echo do_shortcode('[jetpack_subscription_form title="[PARAMETER TITLE]" subscribe_placeholder="[PARAMETER PLACEHOLDER]" subscribe_text="[PARAMETER TEXT]" subscribe_button="[PARAMETER BUTTON]" success_message="[PARAMETER SUCCESS]"]');
?>
/*
The available shortcodes are:
title - the title of the subscription form, for example "Subscribe to the newsletter"
subscribe_text - a line of text above the input box, for example "Sign up for emails"
subscribe_placeholder - the placeholder text in the input box, for example "Enter email here"
subscribe_button - the text that appears on the submit button, for example "Sign Up"
success_message - the text to be displayed upon successful submission of the subscription form, for example "Thanks for subscribing"
*/
@indeedably
Copy link
Author

Example output:

image

@starchildluke
Copy link

Thank you for writing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment