if ( ! empty( $submit_button_classes ) ) {
$instance['submit_button_classes'] = $submit_button_classes;
if ( ! empty( $email_field_classes ) ) {
$instance['email_field_classes'] = $email_field_classes;
if ( ! empty( $submit_button_styles ) ) {
$instance['submit_button_styles'] = trim( $submit_button_styles );
if ( ! empty( $submit_button_wrapper_styles ) ) {
$instance['submit_button_wrapper_styles'] = trim( $submit_button_wrapper_styles );
if ( ! empty( $email_field_styles ) ) {
$instance['email_field_styles'] = trim( $email_field_styles );
if ( ! empty( $success_message ) ) {
$instance['success_message'] = trim( $success_message );
'before_widget' => '<div class="jetpack_subscription_widget">',
the_widget( get_jetpack_blog_subscriptions_widget_classname(), $instance, $args );
$output = ob_get_clean();
add_shortcode( 'jetpack_subscription_form', 'jetpack_do_subscription_form' );
add_shortcode( 'blog_subscription_form', 'jetpack_do_subscription_form' );
* Register the Subscriptions widget.
function jetpack_blog_subscriptions_init() {
register_widget( get_jetpack_blog_subscriptions_widget_classname() );
add_action( 'widgets_init', 'jetpack_blog_subscriptions_init' );
* Sets the default value for `subscription_options` site option.
* This default value is available across Simple, Atomic and Jetpack sites,
* including the /sites/$site/settings endpoint.
* @param array $default Default `subscription_options` array.
* @param string $option Option name.
* @param bool $passed_default Whether `get_option()` passed a default value.
* @return array Default value of `subscription_options`.
function subscription_options_fallback( $default, $option, $passed_default ) {
$site_url = get_home_url();
$display_url = preg_replace( '(^https?://)', '', untrailingslashit( $site_url ) );
/* translators: Both %1$s and %2$s is site address */
'invitation' => sprintf( __( "Howdy,\nYou recently subscribed to <a href='%1\$s'>%2\$s</a> and we need to verify the email you provided. Once you confirm below, you'll be able to receive and read new posts.\n\nIf you believe this is an error, ignore this message and nothing more will happen.", 'jetpack' ), $site_url, $display_url ),
'comment_follow' => __( "Howdy.\n\nYou recently followed one of my posts. This means you will receive an email when new comments are posted.\n\nTo activate, click confirm below. If you believe this is an error, ignore this message and we'll never bother you again.", 'jetpack' ),
/* translators: %1$s is the site address */
'welcome' => sprintf( __( 'Cool, you are now subscribed to %1$s and will receive an email notification when a new post is published.', 'jetpack' ), $display_url ),
add_filter( 'default_option_subscription_options', 'subscription_options_fallback', 10, 3 );