Code Snippet by Matt Hias

"Some time ago I built a Code Snippet to "simulate" Elegant Custom Fonts.

This way I could "inject" my custom font into Oxygen font selections."

// create callback function for Oxygen
if (!class_exists('ECF_Plugin')) :
class ECF_Plugin {
static function get_font_families() {
$font_family_list[] = 'MyFont';
return $font_family_list;
}
}
// create new instance of fake class
$ECF_Plugin = new ECF_Plugin();
// embed font style
add_action( 'wp_footer', function () { ?>
<style id="hke-custom-font">@font-face {font-family:'MyFont';font-weight:400;font-style:normal;src:url(<?php echo get_site_url(); ?>/wp-content/uploads/fonts/myfont/myfont.woff);}</style>
<?php } );
endif;

At the moment, Oxygen only grabs additional fonts via the Elegant Custom Fonts plugin. So, to avoid having an extra plugin, I wrote this snippet that simulates an installed ECF plugin.