Skip to content

Instantly share code, notes, and snippets.

@brianleejackson
Created August 28, 2020 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianleejackson/0e11148e30a650d5a8022e5ae6f030f9 to your computer and use it in GitHub Desktop.
Save brianleejackson/0e11148e30a650d5a8022e5ae6f030f9 to your computer and use it in GitHub Desktop.
Disable Font Awesome in YITH WooCommerce Wishlist
if ( function_exists( 'yith_wishlist_install' ) ){
if ( ! function_exists( 'yith_wcwl_remove_awesome_stylesheet' ) ) {
function yith_wcwl_remove_awesome_stylesheet() {
wp_deregister_style( 'yith-wcwl-font-awesome' );
}
}
add_action( 'wp_enqueue_scripts', 'yith_wcwl_remove_awesome_stylesheet', 20 );
}
@DeoThemes
Copy link

The problem with this script it also dequeues main Wishlist style CSS, since the font-awesome is listed as a dependency.

@brianleejackson
Copy link
Author

@DeoThemes, it could be that something has changed. The code above was actually provided by their support team. https://wordpress.org/support/topic/fontawesome-9/

@DeoThemes
Copy link

Yes, it's no longer working. Will try to find another way. Thanks.

@brianleejackson
Copy link
Author

@DeoThemes Sounds good. If you find an alternative, feel free to drop in a comment here if you have the time. Happy to update my gist.

@DeoThemes
Copy link

DeoThemes commented Feb 25, 2021

@brianleejackson The only way I found is to dequeue font-awesome styles first and then enqueue the rest of the styles again. I'm not sure if it's the best solution and it will not break any code, but for me it's working, I have all the wishlist CSS styles except FontAwesome. So here is the code:

    if ( defined( 'YITH_WCWL' ) ) {
		function yith_wcwl_dequeue_font_awesome_styles() {
			wp_deregister_style( 'woocommerce_prettyPhoto_css' );
			wp_deregister_style( 'jquery-selectBox' );
			wp_deregister_style( 'yith-wcwl-font-awesome' );
			wp_deregister_style( 'yith-wcwl-main' );

			$assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';
			wp_register_style( 'jquery-selectBox', YITH_WCWL_URL . 'assets/css/jquery.selectBox.css', array(), '1.2.0' );
			wp_register_style( 'woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css' );
			wp_register_style( 'yith-wcwl-main', YITH_WCWL_URL . 'assets/css/style.css', array( 'jquery-selectBox' ), '1.0.0' );
		}
		add_action( 'wp_enqueue_scripts', 'yith_wcwl_dequeue_font_awesome_styles', 11 );		
	}

@brianleejackson
Copy link
Author

@DeoThemes, great! Thanks for taking the time to share what's working for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment