Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Use list in customizer field */
- $wp_customize->add_setting(
- 'theme_font', array(
- 'default' => '',
- 'type' => 'option',
- 'capability' => 'edit_theme_options'
- )
- );
- $wp_customize->add_control('theme_font',
- array(
- 'label' => 'Font',
- 'section' => 'typography',
- 'settings' => 'theme_font',
- 'type' => 'select',
- 'choices' => $google_fonts
- )
- );
- /* Use font in front */
- // Get protocol
- protocol = is_ssl() ? 'https' : 'http';
- // Get font array
- $theme_font = is_serialized( get_option('theme_font' ) ) ? unserialize( get_option('lobo_type_1' ) ) : array( 'default' => true, 'font-family' => '"Helvetica Neue", Helvetica, Arial, sans-serif' );
- // Enqueue the font if it's not one of the defaults
- if ( ! isset( $theme_font['default'] ) ) {
- wp_enqueue_style( $theme_font['css-name'], "$protocol://fonts.googleapis.com/css?family=" . $theme_font['css-name'] . ":300,400,400italic,500,600,700,700,800,900" );
- }
- // Custom CSS to paste in your own way
- $custom_font = 'h1, h2, h3, h4, h5, h6 { font-family:' . $theme_font['font-family'] . ';}';
Add Comment
Please, Sign In to add comment