Skip to content

Commit

Permalink
Add a fix to only deregisterFrontendStyles when the frontend editor i…
Browse files Browse the repository at this point in the history
…s used.
  • Loading branch information
timcv committed Sep 8, 2017
1 parent b09986b commit 53f02ff
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/VcCleanUp/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,20 @@ public function useBootstrapGrid($param)
*/
public function deregisterFrontendStyles($param)
{
if (is_user_logged_in()) {
return false;
if (!$param) {
return;
}

if ($param) {
add_action('init', function () {
//Don't deregister VCs CSS when using the frontend editor
if (in_array(vc_mode(), ['page_editable', 'admin_page', 'admin_frontend_editor'])) {
return;
}

add_action('wp_enqueue_scripts', function () {
wp_deregister_style('js_composer_front');
});
}
});
}

/**
Expand Down

0 comments on commit 53f02ff

Please sign in to comment.