Skip to content

Instantly share code, notes, and snippets.

@SeanTOSCD
Created August 30, 2017 22:43
Show Gist options
  • Save SeanTOSCD/ea6bd41ada8c024aa7fcfe3c5df5ac3c to your computer and use it in GitHub Desktop.
Save SeanTOSCD/ea6bd41ada8c024aa7fcfe3c5df5ac3c to your computer and use it in GitHub Desktop.
EDD Stripe replace CC form
<?php // DO NOT COPY THIS LINE
function custom_edd_stripe_new_card_form() {
?>
<p id="edd-card-number-wrap">
<label for="card_number" class="edd-label">
<?php _e( 'Card Number', 'edds' ); ?>
<span class="edd-required-indicator">*</span>
<span class="card-type"></span>
</label>
<span class="edd-description"><?php _e( 'The (typically) 16 digits on the front of your credit card.', 'edds' ); ?></span>
<input type="tel" pattern="^[0-9\s*\w]{13,16}$" id="card_number" class="card-number edd-input required" placeholder="<?php _e( 'Card number', 'edds' ); ?>" autocomplete="cc-number" />
</p>
<p id="edd-card-cvc-wrap">
<label for="card_cvc" class="edd-label">
<?php _e( 'CVC', 'edds' ); ?>
<span class="edd-required-indicator">*</span>
</label>
<span class="edd-description"><?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'edds' ); ?></span>
<input type="tel" pattern="[0-9]{3,4}" size="4" id="card_cvc" class="card-cvc edd-input required" placeholder="<?php _e( 'Security code', 'edds' ); ?>" autocomplete="cc-csc" />
</p>
<p id="edd-card-name-wrap">
<label for="card_name" class="edd-label">
<?php _e( 'Name on the Card', 'edds' ); ?>
<span class="edd-required-indicator">*</span>
</label>
<span class="edd-description"><?php _e( 'The name printed on the front of your credit card.', 'edds' ); ?></span>
<input type="text" id="card_name" class="card-name edd-input required" placeholder="<?php _e( 'Card name', 'edds' ); ?>" autocomplete="cc-name" />
</p>
<?php do_action( 'edd_before_cc_expiration' ); ?>
<p class="card-expiration">
<label for="card_exp_month" class="edd-label">
<?php _e( 'Expiration (MM/YY)', 'edds' ); ?>
<span class="edd-required-indicator">*</span>
</label>
<span class="edd-description"><?php _e( 'The date your credit card expires, typically on the front of the card.', 'edds' ); ?></span>
<select id="card_exp_month" class="card-expiry-month edd-select edd-select-small required" autocomplete="cc-exp-month">
<?php for( $i = 1; $i <= 12; $i++ ) { echo '<option value="' . $i . '">' . sprintf ('%02d', $i ) . '</option>'; } ?>
</select>
<span class="exp-divider"> / </span>
<select id="card_exp_year" class="card-expiry-year edd-select edd-select-small required" autocomplete="cc-exp-year">
<?php for( $i = date('Y'); $i <= date('Y') + 30; $i++ ) { echo '<option value="' . $i . '">' . substr( $i, 2 ) . '</option>'; } ?>
</select>
</p>
<?php
}
remove_action( 'edd_stripe_new_card_form', 'edd_stripe_new_card_form' );
add_action( 'edd_stripe_new_card_form', 'custom_edd_stripe_new_card_form' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment