How to enqueue style in WordPress plugin from theme files?

IF I’m understanding your question correctly, what you want to do is enqueue scripts and stylesheets using a plugin the same way you do with a theme… …if that’s the case then it’s really not that different: function yourplugin_enqueue_frontend() { wp_enqueue_style( ‘yourplugin-front’, plugins_url( ‘yourplugin-front.css’, __DIR__ ), array(), ‘1.0’ ); wp_enqueue_script( ‘yourplugin-front’, plugins_url( ‘yourplugin-front.js’, __DIR__ ), … Read more

Enqueue styles in new site editor in WordPress 5.9

So apparently for the site editor, you need to add the styles a little bit differently. You need to use the add_editor_style function. add_action(‘after_setup_theme’, ‘my_add_editor_styles_to_full_site_editing’); function my_add_editor_styles_to_full_site_editing() { add_theme_support(‘editor-styles’); add_editor_style(‘site-editor.css’); } Becareful how you style your stylesheet This function adds your styles inline wrapped in the .editor-styles-wrapper class.

Override theme style with other CSS on a specific page

You want the plugins style sheet to over ride your themes style sheet conditionally ( on one page). Dequeue your themes style sheet for a specific page conditionally. add_action( ‘wp_enqueue_scripts’, ‘remove_default_stylesheet’, 25 ); function remove_default_stylesheet() { if ( is_page( page id or slug) ) { wp_dequeue_style( ‘original-enqueue-stylesheet-handle’ ); wp_deregister_style( ‘original-register-stylesheet-handle’ ); wp_register_style( ‘new-style’, plugins_url(‘stylesheet.css’, __FILE__) … Read more