Actually, this variant is already obsolete, if not already deprecated. However, I use this method in some projects. If e.g. Font Awesome 5 Pro has already been purchased and there is no access to the CDN. With the integration of the u.g. Code snippets in the functions.php, there is still the possibility to use the premium icons in Elementor.

In Elementor, the Font Awesome 5 CDN can only be used with the license key.

function enqueue_icon_font() {
    wp_enqueue_style('font-awesome-5', 'https://use.fontawesome.com/releases/v5.1.0/css/all.css');
}

add_action('wp_enqueue_scripts', 'enqueue_icon_font', 1);
add_action('elementor/editor/before_enqueue_styles', 'enqueue_icon_font', 1);

add_action('elementor/controls/controls_registered', function ($controls_registry) {
    $icons = $controls_registry->get_control('icon')->get_settings('options');
    $new_icons = array_merge(
        array(
            'fab fa-elementor' => 'elementor',
        ),
        $icons
    );

    $controls_registry->get_control('icon')->set_settings('options', $new_icons);
}, 10, 1);

Leave a Reply

Your email address will not be published. Required fields are marked *