Skip to content

Instantly share code, notes, and snippets.

@Apina
Created July 30, 2014 09:42
Show Gist options
  • Save Apina/859114d98ef18b77bd32 to your computer and use it in GitHub Desktop.
Save Apina/859114d98ef18b77bd32 to your computer and use it in GitHub Desktop.
This should no longer be required after 4.6.4 as there is an option in the Gateway settings -- Adds a little jQuery to automatically open the Payment options.
<?php
/*
Plugin Name: EE adds JavaScript to show the payment options automatically.
Description: EE adds JavaScript to show the payment options automatically.
*/
/* Begin Adding Functions Below This Line */
function ee_1() {
if(is_singular()) {
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#spco-go-to-step-payment_options-btn').click(function() {
if (jQuery('.reg-page-payment-option-dv').length == 1) {
setTimeout(function(){jQuery('.reg-page-payment-option-dv').click();}, 2000);
}
});
});
</script>
<?php
}
}
add_action('wp_footer', 'ee_1', 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment