ThemeFuse / Unyson

A WordPress framework that facilitates the development of WP themes
http://unyson.io
922 stars 217 forks source link

Woocomerce plugin and color-picker option type #1822

Closed dylan-ngo11 closed 8 years ago

dylan-ngo11 commented 8 years ago

The color picker doesn't work well when Woocomerce plugin is activated. I think it must be conflict with woocomerce plugin javascript file. Please see the video here: http://take.ms/gvqkI

ghost commented 8 years ago

I can't reproduce it https://vid.me/nNDI

dylan-ngo11 commented 8 years ago

Sorry, I found that not woocomerce, please test with this plugin: https://wordpress.org/plugins/yith-woocommerce-wishlist/

ghost commented 8 years ago
ghost commented 8 years ago

Please report this problem to plugin author.

dylan-ngo11 commented 8 years ago

It seems that they don't give the support. So I tried to deregister this js file in Edit page. I tested this code but it didn't work.

add_action( 'admin_enqueue_scripts', 'topseo_deregister_woocommerce_setting', 10, 1 );
function topseo_deregister_woocommerce_setting(){
    wp_deregister_script( 'woocommerce_settings' );
}

any suggestions?

danyj commented 8 years ago

I opened a ticket https://wordpress.org/support/topic/please-remove-unecessary-scripts/

dylan-ngo11 commented 8 years ago

@danyj If you see the history of support forum, I don't think the author take the support. That's why I try to figure out the solution.

danyj commented 8 years ago

try this

add_action( 'admin_enqueue_scripts', 'topseo_deregister_woocommerce_setting', 99);

I used that to remove jquery-ui-style

if( is_admin() ){ 
    function _thz_action_remove_woo_jquery_ui_css() {

        if ( class_exists( 'WooCommerce' )  ) {
            wp_dequeue_style( 'jquery-ui-style' );
        }
    }

    add_action( 'admin_enqueue_scripts', '_thz_action_remove_woo_jquery_ui_css', 99 );
}
danyj commented 8 years ago

are you sure that the handle is woocommerce_settings ?

dylan-ngo11 commented 8 years ago

https://github.com/ThemeFuse/Unyson/issues/1822#issuecomment-238208119

I checked in page source and it was right.

dylan-ngo11 commented 8 years ago

I don't know why but change to 99 and it works. I set 100 in the beginning but It did not. Thank @danyj

dylan-ngo11 commented 8 years ago

So now it's my solution for this problem. Hope it helps someone!

add_action( 'admin_enqueue_scripts', 'topseo_deregister_woocommerce_setting', 99 );

    function topseo_deregister_woocommerce_setting(){
        $screen = get_current_screen();
        if ( $screen->post_type == 'page' ){
                wp_deregister_script( 'woocommerce_settings' );
        }
    }
tuan-ph commented 7 years ago

Many thanks to @duongancol , it works, i'm finding detailed reason to customize it fit with my project.

dylan-ngo11 commented 7 years ago

@tuan-ph You're welcome, bro!

biklik commented 7 years ago

thanks @duongancol!

dylan-ngo11 commented 7 years ago

@biklik You're welcome.