/** * Function that creates <link> and <style> font definitions to added to theme head * Calls the settings from theme options panel and maps with the multidimensional array served by base_typo(); * Creates inline style for main font */ function add_theme_fonts() { $fonts = new WpsGetThemeFonts(); $font_main = wps_get_theme_option('main_font_family'); // Get selected font family option. /* If no font is set return */ if (!isset($font_main)) { return; } else { wp_register_style('theme_main_font', $fonts->get_theme_fonts_link()); wp_enqueue_style('theme_main_font'); wp_add_inline_style('theme_main_font', $fonts->get_theme_font_style()); } }
<?php /** * Typography Settings * * Title: Typography Settings * Setting: wps_prime_settings * Tab: Typography * Flow: WPS Settings Workflow * * @package wps_prime */ /** * Get typography settings from theme typography.php */ $fonts = new WpsGetThemeFonts(); piklist('field', array('type' => 'select', 'field' => 'main_font_family', 'label' => 'Body Font', 'description' => 'Choose from the drop-down.', 'help' => 'Choose what font family to use as the main Body font.', 'attributes' => array('class' => 'text'), 'choices' => $fonts->get_fonts_name())); piklist('field', array('type' => 'checkbox', 'field' => 'font_family_subset', 'value' => '', 'label' => 'Load fonts subset', 'description' => 'Will load Latin and Latin-ext font subset (where avaliable). <span class="dashicons dashicons-warning"></span> This option has performance impact.', 'attributes' => array('class' => 'text'), 'choices' => array('load_subset' => 'Load font subset'))); piklist('field', array('type' => 'radio', 'field' => 'second_font_family_status', 'value' => 'disabled', 'label' => 'Heading Font', 'description' => 'Set different font family for headings. <span class="dashicons dashicons-warning"></span> This option has performance impact', 'attributes' => array('class' => 'text'), 'choices' => array('disabled' => 'Disable', 'enabled' => 'Enable'))); piklist('field', array('type' => 'select', 'field' => 'secondary_font_family', 'label' => 'Heading Font', 'description' => 'Choose from the drop-down.', 'help' => 'Choose what font family to use as the main Heading font.', 'conditions' => array(array('field' => 'second_font_family_status', 'value' => 'enabled')), 'attributes' => array('class' => 'text'), 'choices' => $fonts->get_fonts_name()));