From 865039153f6891154f2dcd4b89fc15e7f95025fe Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Fri, 6 May 2022 10:12:52 -0600 Subject: [PATCH 1/2] Add a front end JQuery enqueue check --- checks/class-jquery-check.php | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 checks/class-jquery-check.php diff --git a/checks/class-jquery-check.php b/checks/class-jquery-check.php new file mode 100644 index 00000000..6bf2c3c4 --- /dev/null +++ b/checks/class-jquery-check.php @@ -0,0 +1,55 @@ +error[] = sprintf( + '%s: %s', + __( 'RECOMMENDED', 'theme-check' ), + sprintf( + 'JQuery is enqueued on the front end, however you may not need it, see this article for tips on switching to vanilla JavaScript.', + 'https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/' + ) + ); + } + return true; + } + + /** + * Get error messages from the checks. + * + * @return array Error message. + */ + public function getError() { + return $this->error; + } +} + +$themechecks[] = new JQuery_Check(); From 21f0a9142cb145e552c0bb3863b532d4072c0650 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Mon, 16 May 2022 12:51:51 -0600 Subject: [PATCH 2/2] Update link, point to make post --- checks/class-jquery-check.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checks/class-jquery-check.php b/checks/class-jquery-check.php index 6bf2c3c4..150adb99 100644 --- a/checks/class-jquery-check.php +++ b/checks/class-jquery-check.php @@ -35,7 +35,7 @@ public function check( $php_files, $css_files, $other_files ) { __( 'RECOMMENDED', 'theme-check' ), sprintf( 'JQuery is enqueued on the front end, however you may not need it, see this article for tips on switching to vanilla JavaScript.', - 'https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/' + 'https://make.wordpress.org/themes/2021/10/04/the-performance-impact-of-using-jquery-in-wordpress-themes/' ) ); }