Skip to content

Instantly share code, notes, and snippets.

@madila
Last active October 27, 2021 10:19
Show Gist options
  • Save madila/9a92985f369535efd8f9778c160a0c46 to your computer and use it in GitHub Desktop.
Save madila/9a92985f369535efd8f9778c160a0c46 to your computer and use it in GitHub Desktop.
Add Adobe Fonts kit to WordPress new Editor
<?php
/*
Plugin Name: My Theme - Enqueue Adobe Fonts
Plugin URI: https://wordpress.org
Description: Must-use plugin for custom actions and filters to run for a site
Version: 0.1
Author: Ruben Madila
Author URI: https://rubenmadila.com
*/
/** Enqueue Adobe Fonts **/
function my_theme_webfont_url($webfont_url) {
return 'https://use.typekit.net/yti3iou.css';
}
add_filter('my_theme_custom_webfont', 'my_theme_webfont_url');
function my_theme_add_late_assets() {
wp_enqueue_style('my-theme-font', apply_filters( 'my_theme_custom_webfont', ''), array(), null);
}
add_action( 'wp_footer', 'my_theme_add_late_assets');
function my_theme_add_editor_styles() {
add_editor_style( array( apply_filters( 'my_theme_custom_webfont', '') ));
}
add_action('after_setup_theme', 'my_theme_add_editor_styles' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment