Created
November 15, 2017 08:17
-
-
Save andrewlimaza/1e3344ab73458c40b812262198599f61 to your computer and use it in GitHub Desktop.
Mailchimp additional opt-in list check by default.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This snippet sets the additional opt-in lists for MailChimp to be selected on Paid Memberships Pro checkout page. | |
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_mailchimp_check_by_default() { | |
global $pmpro_pages; | |
//only load this on the PMPro checkout page. | |
if( is_page( $pmpro_pages['checkout'] ) ) { | |
?> | |
<script> | |
jQuery(document).ready(function() { | |
jQuery('#additional_lists_1').prop('checked', true); //copy this and change the #additional_lists_1 to match the input checkbox ID's | |
}); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'pmpro_mailchimp_check_by_default' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment