Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cybmeta_dequeue_fontawsome() {
- global $wp_styles;
- // we use preg_match to find only the following patterns as exact matches, to prevent other stylesheets that contain font-awesome expression to be also dequeued
- $patterns = array(
- 'font-awesome.css',
- 'font-awesome.min.css'
- );
- $regex = '/(' .implode('|', $patterns) .')/i';
- foreach( $wp_styles -> registered as $registered ) {
- if( preg_match( $regex, $registered->src) ) {
- wp_dequeue_style( $registered->handle );
- // FA was dequeued, so here we need to enqueue it again from the location we want (cdn in our code)
- wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' );
- }
- }
- }
- add_action( 'wp_enqueue_scripts', 'cybmeta_dequeue_fontawsome' );
Add Comment
Please, Sign In to add comment