From ac2a8bdf4744d0f2729e4a67dbc80cbd50fa664a Mon Sep 17 00:00:00 2001 From: Nikolas Ramstedt Date: Fri, 15 Sep 2023 12:59:14 +0200 Subject: [PATCH] check presence of module before enqueue --- source/php/Modules/AboutMe/AboutMe.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/php/Modules/AboutMe/AboutMe.php b/source/php/Modules/AboutMe/AboutMe.php index 8893520..4fa7cab 100644 --- a/source/php/Modules/AboutMe/AboutMe.php +++ b/source/php/Modules/AboutMe/AboutMe.php @@ -62,15 +62,19 @@ public function template(): string public function script() { + if (!$this->hasModule()) { + return; + } + wp_enqueue_script( - 'gdi-modularity-about-me-js', - GDI_ABOUT_ME_URL . '/dist/' . CacheBust::name('js/gdi-modularity-about-me.js'), - null + 'gdi-modularity-about-me-js', + GDI_ABOUT_ME_URL . '/dist/' . CacheBust::name('js/gdi-modularity-about-me.js'), + null ); wp_enqueue_style( - 'gdi-modularity-about-me-css', - GDI_ABOUT_ME_URL . '/dist/' . CacheBust::name('js/gdi-modularity-about-me.css'), - null + 'gdi-modularity-about-me-css', + GDI_ABOUT_ME_URL . '/dist/' . CacheBust::name('js/gdi-modularity-about-me.css'), + null ); } }