Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Enqueue google font from BUILDER

Open webangon opened this issue 11 years ago • 3 comments

Hi

I have seen several solutions to use google webfonts from theme settings . But I have used font in shortcode bulider. How can I print/enqueue this font?

Thanks

webangon avatar Sep 05 '15 15:09 webangon

Try:

  • In {theme}/framework-customizations/extensions/shortcodes/shortcodes/{shortcode}/static.php

    global $_theme_fw_shortcodes_google_fonts;
    if (empty($_theme_fw_shortcodes_google_fonts)) $_theme_fw_shortcodes_google_fonts = array();
    
    $_theme_fw_shortcodes_google_fonts['FONT_ID'] = array(/* font data */);
    
  • In {theme}/framework-customizations/extensions/shortcodes/hooks.php

    add_action('wp_enqueue_scripts', '_action_theme_fw_shortcodes_google_fonts', 9999);
    function _action_theme_fw_shortcodes_google_fonts() {
        global $_theme_fw_shortcodes_google_fonts;
    
        if (empty($_theme_fw_shortcodes_google_fonts)) return;
    
        // enqueue the fonts
    }
    

ghost avatar Sep 09 '15 14:09 ghost

Thank you for reply. But I want it to be done within plugin. Is it possible?

webangon avatar Sep 10 '15 18:09 webangon

It's not possible.

If you know a good, simple to use solution, please share.

ghost avatar Sep 10 '15 19:09 ghost