Home>Support>Cancel admin.css file and replace per the myfile.css in my plugin

Cancel admin.css file and replace per the myfile.css in my plugin

Hello,

I am creating a plugin that improves the user interface for admin backend Page Builder SiteOrigin. To make changes, I first edited the file css/admin.css (the plugin siteorigin) and everything was perfect.

Now, I create my own css file on my plugin (interface.css) and want to use it all, without having to be adding “! Important”. I added this code below to deregister the style function “so-panels-admin”.

function my_deregister_styles() {
wp_deregister_style( 'so-panels-admin' );
// deregister as many stylesheets as you need...
}

However, it is not working. How can I undo your file “css/admin.css” and replace with “myplugin/css/interface.css” in my plugin?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 7 months ago Greg Priday
    Hi, I Work Here

    Hi Lucas

    I’m very interested to see what plugin you’re developing here. Are they improvements we could incorporate into Page Builder in general?

    I’m not exactly sure how to do this, but I think you might need to use wp_dequeue_style style instead.

    https://codex.wordpress.org/Function_Reference/wp_dequeue_style

    Also, make sure that you hook your function to admin_enqueue_scripts with a priority lower than 10. So maybe 15, to ensure it runs after Page Builder’s enqueues.

    https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts

    All that said, it’s generally a much better idea for compatibility to just ensure your style works in conjunction with the default Page Builder scripts.

  2. 8 years, 7 months ago Private Message - Lucas Tolle

    This is a private message.

  3. 8 years, 7 months ago Lucas Tolle

    Tell me what you think of the idea.

  4. 8 years, 7 months ago Lucas Tolle

    Greg Friday, I’ve tried everything and I’m not getting.
    I do not know if the code for your plugin is forcing to take priority …

    MY PLUGIN:

    function interfaceso_theme() {
            wp_register_style( 'interfaceso_css', plugins_url('interface-so.css', __FILE__), false, '1.0.0' );
            wp_enqueue_style( 'interfaceso_css' );
    }
    
    add_action( 'admin_enqueue_scripts', 'interfaceso_theme', 10);
    
    
    function remove_custom_head_stylesheet() {
    	wp_dequeue_style('so-panels-admin');
    	wp_deregister_style( 'so-panels-admin' );
    }
    add_action( 'remove_custom_head_stylesheet', 20); 
    
     

    I’ve tried all priorities.

    YOUR PLUGIN IN: siteorigin-panels.php

    function siteorigin_panels_admin_enqueue_styles( $prefix = '', $force = false ) {
    	if ( $force || siteorigin_panels_is_admin_page() ) {
    		wp_enqueue_style( 'so-panels-admin', plugin_dir_url(__FILE__) . 'css/admin.css', array( 'wp-color-picker' ), SITEORIGIN_PANELS_VERSION );
    		do_action( 'siteorigin_panel_enqueue_admin_styles' );
    	}
    }

    Nothing happens. Help me please. I just need it to launch the plugin.

  5. 8 years, 7 months ago Greg Priday
    Hi, I Work Here

    That’s a very cool looking design :)

    I an see just one problem with your code. You just need to add in the action for the one add_action call.

    function remove_custom_head_stylesheet() {
    	wp_dequeue_style('so-panels-admin');
    	wp_deregister_style( 'so-panels-admin' );
    }
    add_action( 'admin_enqueue_scripts', 'remove_custom_head_stylesheet', 20); 
    

    Please let me know if that does the trick.

  6. 8 years, 7 months ago Lucas Tolle

    Greg, I changed, but not yet worked.
     
    I suspect it is a matter of “priorities”. If I could at least leave my CSS to be the last one loaded, already solve my problem. For as the “so-panels-admin” can not disable it.

    I looked for information on the internet, and I dedicated myself more than 12 hours from yesterday to today (overnight and all morning). But nothing has been resolved.

  7. 8 years, 7 months ago Lucas Tolle

    Greg,

    Remember my plug-in that gives a new look to your PageBuilder SiteOrigin? Well. I got that scheme on “dequeue” and I’m ending it. Will soon be available in the repository.

    Thank you for your support.

  8. 8 years, 7 months ago Greg Priday
    Hi, I Work Here

    I’m excited to see it! Are you submitting it to the WordPress.org directory?

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More