
-
AuthorPosts
-
May 21, 2015 at 10:33 pm #448051
I don’t think you can download the fonts at fonts.com like you can other fonts. Most themes are now letting people specify custom font-families. So that if I can add the javascript from fonts.com or use a plugin to add it, I can make that work. Any chance of adding that to Enfold. It’s pretty standard practice now.
Here’s my work around, and it mostly works, it’s not quite perfect, the theme doesn’t always respect the font-weights.
function header_fontsdotcom () { ?>
<!– Fonts.com import–>
<link type=”text/css” rel=”stylesheet” href=”http://fast.fonts.net/cssapi/YOURAPI.css”/><?php }
add_action( ‘wp_head’, ‘header_fontsdotcom’);add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font1’);
function avia_add_heading_font1($fonts)
{
$fonts[‘Trade Gothic Light’] = ‘Trade Gothic W01:200’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font1’);
function avia_add_content_font1($fonts)
{
$fonts[‘Trade Gothic Light’] = ‘Trade Gothic W01:200’;
return $fonts;
}add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font2’);
function avia_add_heading_font2($fonts)
{
$fonts[‘Trade Gothic’] = ‘Trade Gothic W01:400’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font2’);
function avia_add_content_font2($fonts)
{
$fonts[‘Trade Gothic’] = ‘Trade Gothic W01:400’;
return $fonts;
}add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font3’);
function avia_add_heading_font3($fonts)
{
$fonts[‘Trade Gothic Condensed’] = ‘Trade Gothic W01:600’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font3’);
function avia_add_content_font3($fonts)
{
$fonts[‘Trade Gothic Condensed’] = ‘Trade Gothic W01:600’;
return $fonts;
}
add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font4’);
function avia_add_heading_font4($fonts)
{
$fonts[‘Trade Gothic Bold’] = ‘Trade Gothic W01:700’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font4’);
function avia_add_content_font4($fonts)
{
$fonts[‘Trade Gothic Bold’] = ‘Trade Gothic W01:700’;
return $fonts;
}add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font5’);
function avia_add_heading_font5($fonts)
{
$fonts[‘Trade Gothic Bold 2’] = ‘Trade Gothic W01:800’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font5’);
function avia_add_content_font5($fonts)
{
$fonts[‘Trade Gothic Bold 2’] = ‘Trade Gothic W01:800’;
return $fonts;
}add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font6’);
function avia_add_heading_font6($fonts)
{
$fonts[‘Trade Gothic Condensed Bold’] = ‘Trade Gothic W01:900’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font6’);
function avia_add_content_font6($fonts)
{
$fonts[‘Trade Gothic Condensed Bold’] = ‘Trade Gothic W01:900’;
return $fonts;
}May 23, 2015 at 2:22 am #448813Hi!
That’s the correct method right now, you can refactor your code to be like this:
function header_fontsdotcom () { ?> <!– Fonts.com import –> <link type="text/css" rel="stylesheet" href="http://fast.fonts.net/cssapi/YOURAPI.css"/> <?php } add_action( 'wp_head', 'header_fontsdotcom'); add_filter( 'avf_google_heading_font', 'add_custom_fonts'); add_filter( 'avf_google_content_font', 'add_custom_fonts'); function add_custom_fonts($fonts) { $fonts['Trade Gothic Light'] = 'Trade Gothic W01:200'; $fonts['Trade Gothic'] = 'Trade Gothic W01:400'; $fonts['Trade Gothic Condensed'] = 'Trade Gothic W01:600'; $fonts['Trade Gothic Bold'] = 'Trade Gothic W01:700'; $fonts['Trade Gothic Bold 2'] = 'Trade Gothic W01:800'; $fonts['Trade Gothic Condensed Bold'] = 'Trade Gothic W01:900'; return $fonts; } add_action( 'init', 'enfold_customization_switch_fonts' ); function enfold_customization_switch_fonts() { global $avia; $avia->style->print_extra_output = false; }
The last hook is to disable the Google Font call that gets added by default when adding custom Fonts (this was meant to be used with Google Fonts only).
Best regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.