diff --git a/src/DoubleTheDonation/Assets.php b/src/DoubleTheDonation/Assets.php index 049be20..a26166c 100644 --- a/src/DoubleTheDonation/Assets.php +++ b/src/DoubleTheDonation/Assets.php @@ -32,18 +32,24 @@ public static function loadBackendAssets() { * @return void */ public static function loadFrontendAssets() { - wp_enqueue_script( - 'give-double-the-donation-style-script', + 'give-double-the-donation-script', 'https://doublethedonation.com/api/js/ddplugin.js', [] ); + wp_enqueue_style( 'give-double-the-donation-style', 'https://doublethedonation.com/api/css/ddplugin.css', [] ); - + wp_enqueue_script( + 'give-double-the-donation-script-frontend', + GIVE_DTD_URL . 'public/js/give-double-the-donation.js', + ['give-double-the-donation-script'], + GIVE_DTD_VERSION, + true + ); } } diff --git a/src/DoubleTheDonation/DonationForm.php b/src/DoubleTheDonation/DonationForm.php index 3ab537c..6b54b7a 100644 --- a/src/DoubleTheDonation/DonationForm.php +++ b/src/DoubleTheDonation/DonationForm.php @@ -25,24 +25,21 @@ public function employerMatchField( $form_id ) { } // Do not handle legacy donation form. - $labelStyle = ! FormUtils::isLegacyForm() ? 'style="display: block !important; font-size: 14px;"' : ''; - $divStyle = ! FormUtils::isLegacyForm() ? 'style="margin: 0 0 20px;"' : ''; - + $isLegacyForm = FormUtils::isLegacyForm(); + $labelStyle = ! $isLegacyForm ? 'style="display: block !important; font-size: 14px;"' : ''; + $divStyle = ! $isLegacyForm ? 'style="margin: 0 0 20px;"' : ''; $dtdLabel = give_get_meta( $form_id, 'give_dtd_label', true, esc_html__( 'See if your company will match your donation!', 'give-double-the-donation' ) ); ?>