Skip to content

Instantly share code, notes, and snippets.

@chasereeves
Created October 22, 2014 02:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chasereeves/bcd7ac1adb927a95eda7 to your computer and use it in GitHub Desktop.
Save chasereeves/bcd7ac1adb927a95eda7 to your computer and use it in GitHub Desktop.
<?
//=========================================================== SUBSCRIBER SHORTCODE
function subscriber_shortcode($atts, $content = null ) {
extract(shortcode_atts(array(
'page' => '',
'headline' => 'Subscribe for free updates',
'button' => 'Subscribe',
'quote' => '',
'class' => 'box_main',
'form_class' => 'centered_form',
'btn_class' => '',
'giveaway' => '',
'success' => 'Alright! You&rsquo;re on the list. Excited to have you on board.',
), $atts));
if($class != 'none') { $return_string = '<div class="'.$class.'">'; }
$return_string .= '<form method="post" class="'.$form_class.' fz_subscribe_form" action="" id="">';
if($headline != 'none') { $return_string .= '<h2>'.$headline.'</h2>'; }
if($content != '') { $return_string .= '<p>'.$content.'</p>'; }
$return_string .= '
<p class="error text_alert" style="display:none"></p>
<input class="text" type="email" name="email" required="required" placeholder="Enter your email" />
<input type="hidden" name="formloc" value="'.$page.'" />
';
if(!empty($giveaway)) { $return_string .= '<input type="hidden" name="giveaway" value="'.$giveaway.'" />'; }
$return_string .= '
<input class="submit no_margin '.$btn_class.'" type="submit" name="submit" value="'.$button.'" onClick="_gaq.push([\'_trackEvent\', \'Email\', \'Subscribe\', \''.$page.'\']);" />
<img src="http://fizzle.co/images/loading.gif" id="loadingGif" style="display:none;"/>
<p class="success text_alert" style="display:none">'.$success.'</p>
';
$return_string .= '</form>';
if($quote != '') {
$return_string .= '
<br/>
<p class="center quiet"><em>'.$quote.'</em></p>
';
}
if($class != 'none') { $return_string .= '</div>'; }
return $return_string;
}
add_shortcode('subscribe', 'subscriber_shortcode');
//=========================================================== USAGE:
// [subscribe headline="Get our insights stream" page="about_top" giveaway="AUDGUIDE" success="Awesome! We&rsquo;ll send you the guide shortly." quote="&ldquo;I have been dreaming of this blog for quite some time, so I am beyond thrilled that I am making it a reality. Fizzle has been a tremendous help in giving me the knowledge, confidence and courage to get this off the ground. Thank you!!!&rsquo; ~ Denise R."]Enter your email and we&rsquo;ll send you a weekly email to help you grow your online business. We&rsquo;ll also send you our guide to defining your audience, the FIRST step in knowing how to find, delight and grow your audience.[/subscribe]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment