function wppb_font_family() { // Default font options $possible = array('Georgia, serif', 'Courier, monospace', 'Zapf-chancery, cursive', 'Western, fantasy', 'Verdana, sans-serif', 'Helvetica Neue, Arial', 'Times, serif'); // Adding options from WP Paintbrush Fonts plugin if (function_exists('wppb_embeddable_fonts')) { foreach (wppb_embeddable_fonts() as $font => $details) { if ('on' == get_wppb_font_option('fontembed_' . $font)) { array_push($possible, "'" . $font . "', sans-serif"); } } } return $possible; }
/** * Embedding fonts * @since 0.1 */ function wppb_load_fonts() { foreach (wppb_embeddable_fonts() as $font => $details) { if ('on' == get_wppb_font_option('fontembed_' . $font)) { wp_enqueue_style('pressabl-' . $font, $details['url'], false, '', 'screen'); } } }
<!DOCTYPE html> <html dir="ltr" lang="en-US"> <head> <meta charset="UTF-8" /> <title>Pressabl theme font test page</title> <?php /** * Inject font here */ foreach (wppb_embeddable_fonts() as $font => $details) { $details['url'] = str_replace('PRESSABL_INTERNAL_FONT_', get_template_directory_uri() . '/fonts', $details['url']); if ($_GET['font_test'] == $font) { echo "\t<link rel='stylesheet' href='" . $details['url'] . "' type='text/css' />\n"; $current_font = $details['family']; } } ?> <style type="text/css"> span,p { font-family: '<?php echo $current_font; ?> '; margin: 10px 0; display: block; line-height: 36px; } </style> </head> <body>