Skip to content

Commit

Permalink
Merge pull request #379 from nextgenthemes/patch-1
Browse files Browse the repository at this point in the history
Fix jQuery not found error when jquery is loaded with defer
  • Loading branch information
bmarshall511 authored Apr 5, 2024
2 parents 5397119 + 981edac commit 83ea736
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/comments/class-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ public function add_scripts() {
'enabled' === \ZeroSpam\Core\Settings::get_settings( 'davidwalsh' )
) {
wp_enqueue_script( 'zerospam-davidwalsh' );
add_action( 'wp_footer', function() {
// .wpd_comm_form for the wpDiscuz plugin
echo '<script type="text/javascript">jQuery(".comment-form, #commentform, .wpd_comm_form").ZeroSpamDavidWalsh();</script>';
}, 999 );
add_action(
'wp_footer',
function (): void {
// .wpd_comm_form for the wpDiscuz plugin
echo '<script type="text/javascript">document.addEventListener("DOMContentLoaded", function() { jQuery(".comment-form, #commentform, .wpd_comm_form").ZeroSpamDavidWalsh(); });</script>';
},
999
);
}
}

Expand Down

0 comments on commit 83ea736

Please sign in to comment.