Skip to content

Commit

Permalink
Merge pull request #1317 from greenpeace/fix-jquery-when-logged-in
Browse files Browse the repository at this point in the history
PLANET-5971 Fix blocks js loading when logged in
  • Loading branch information
Inwerpsel authored Feb 25, 2021
2 parents 4dc6173 + 94dc340 commit 8cbe50b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MasterSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,9 @@ public function enqueue_public_assets() {
// This loads a linked style file since the relative images paths are outside the build directory.
wp_enqueue_style( 'parent-style', $this->theme_dir . '/assets/build/style.min.css', [], $css_creation );

$jquery_deps = is_plugin_active( 'planet4-plugin-gutenberg-blocks/planet4-gutenberg-blocks.php' ) ? [ 'planet4-blocks-frontend' ] : [];
$jquery_should_wait = is_plugin_active( 'planet4-plugin-gutenberg-blocks/planet4-gutenberg-blocks.php' ) && ! is_user_logged_in();

$jquery_deps = $jquery_should_wait ? [ 'planet4-blocks-frontend' ] : [];

// JS files.
wp_deregister_script( 'jquery' );
Expand Down

0 comments on commit 8cbe50b

Please sign in to comment.