• Resolved nyoz

    (@nyoz)


    Hi, great plugin, thanks !

    I was wondering if there was a way to load FontAwesome style sheet from CDN rather than local ?

    Ex. : //maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css

    I bet you have to extends Menu_Icons_Type_Fonts where type = 'fa' and change this

    public function __construct() {
    		$this->stylesheet = sprintf(
    			'%scss/font-awesome%s.css',
    			Menu_Icons::get( 'url' ),
    			Menu_Icons::get_script_suffix()
    		);
    
    		parent::__construct();
    	}

    To this :

    $this->stylesheet = sprintf(
    			'//maxcdn.bootstrapcdn.com/font-awesome/ [CHECK ICON $version] /css/font-awesome.min.css');
    }

    But how to make that the most properly, and overall plugin update compatible ?

    Thanks for your help and your plugin ! 🙂

    https://wordpress.org/plugins/menu-icons/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey!

    Good question. I didn’t think of this before. In the next plugin update, I’ll make the whole properties of each icon types filterable. For now, You can override the stylesheet source by adding this into your theme’s functions.php or preferably a mu-plugins file:

    add_action( 'wp_enqueue_scripts', '_my_styles', 5 );
    function _my_styles() {
    	wp_register_style(
    		'fa',
    		'//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css',
    		false,
    		'4.1.0'
    	);
    }

    And here’s how you filter the icon type properties (after the update’s released, of course):

    add_filter( 'menu_icons_fa_props', '_my_fontawesome_props' );
    function _my_fontawesome_props( $props ) {
    	$props['stylesheet'] = '//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css';
    
    	return $props;
    }
    Thread Starter nyoz

    (@nyoz)

    Great, thanks !

    I’ll wait for the update then, as the site is still in development.
    Once I’d have tried, I’ll come back here to post the follow up. 😉

    Cheers !

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘FontAwesome CDN’ is closed to new replies.