Jump to content

Archived

This topic is now archived and is closed to further replies.

ketri

How to enqueue the components.css stylesheet for only the editing sidebar?

Recommended Posts

ketri

Hi,

Is there a function I could use to load a stylesheet only for the editing sidebar but not the main content which is it's own iframe when editing the page?


I've spent a few days going throug PL5 and you weren't kidding about it being developer friendly. Very impressed.

I want to make some heavier customizations via CSS (like editing the grid gutter for various breakpoints) etc. so I've used:
 

function project_dequeue_unnecessary_styles() {
  wp_dequeue_style( 'pl-components' );
  wp_deregister_style( 'pl-components' );
}

add_action( 'wp_print_styles', 'project_dequeue_unnecessary_styles' );

in functions.php, and then copy-pasted an edited version of components.css to my LESS-imports. 
I also just want to have a single CSS file to reduce loading time and get a full control over all the details.

The problem is that the main style.css of my child-theme gets loaded only inside the main-iframe and not the right hand side editing sidebar so it's a bit messy.

Thanks!

 

 

Share this post


Link to post
Share on other sites
Andrew

Just use this function as a guard on your deregister: 

if( ! pl_tools_active() ){
// deregister
}

 

Share this post


Link to post
Share on other sites
ketri

Just a minor issue. Now when the pl tools is not active, the client cannot see the small icon the admin bar that lets them activate it. What would be the best way to fix this?

Share this post


Link to post
Share on other sites

×