Loading Custom Icon Fonts

This is an example of how loading a custom font-icon may work. For this example Fontello font is used to create a custom icon set and accompanying CSS.

The following code assumes that you’ve added the Fontello files in the /wp-content/themes/your-theme/fontello/ directory, where the stylesheet is named my-fontello.css.

function enqueue_fontello_font() {
    wp_enqueue_style( 'fontello_icon_font', get_stylesheet_directory_uri() . '/fontello/css/my-fontello.css' );
}

add_action( 'gform_enqueue_scripts', 'enqueue_fontello_font' );
add_action( 'admin_enqueue_scripts', 'enqueue_fontello_font' );

The above code enqueues the Fontello font both on the WP Admin pages and every time Gravity Forms is loaded on the front-end.

After adding this code you should be able to use your custom icon font via the Image / Icon Selector.

Have a thought? We're all ears!

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