CodeStar Typography Field Implementation

Too enqueue Google fonts ,write the code in your main functions.php –

[php]
if ( ! function_exists( ‘cs_wp_enqueue_scripts’ ) ) {
function cs_wp_enqueue_scripts() {

$enqueue_fonts = array();
$google_fonts = array();
$google_fonts[] = cs_get_option( ‘maintenance_main_typography_one’ );
$google_fonts[] = cs_get_option( ‘maintenance_main_typography_two’ );

if ( ! empty( $google_fonts ) ) {
foreach ( $google_fonts as $font ) {
if( isset( $font[‘font’] ) && $font[‘font’] == ‘google’ ) {
$variant = ( isset( $font[‘variant’] ) && $font[‘variant’] !== ‘regular’ ) ? ‘:’. $font[‘variant’] : ”;
$enqueue_fonts[] = $font[‘family’] . $variant;
}
}
}

if ( ! empty( $enqueue_fonts ) ) {
wp_enqueue_style( ‘maintenance-google-fonts’, esc_url( add_query_arg( ‘family’, urlencode( implode( ‘|’,
$enqueue_fonts ) ) , ‘//fonts.googleapis.com/css’ ) ), array(), ‘1.0’, true );
}

}
add_action( ‘wp_enqueue_scripts’, ‘cs_wp_enqueue_scripts’ );
}
[/php]

To bring all the variant of the font, we can replace the $variant (line no. 13) with ‘:100,300,500,700,900’ and comment the line 12.
Then write an inline style file like style.php –

[php]
// Inline Scripts
if ( ! function_exists( ‘maintenance_inline_style’ ) ) {
function maintenance_inline_style() {
wp_enqueue_style( ‘maintenance-custom-style’, MAINTENANCE_URL . ‘templates/inc/custom-style.css’, array(), ‘1.0’,
false );

// Typography
$font_ones = cs_get_option( ‘maintenance_main_typography_one’ );
$font_one = $font_ones[‘family’];
$font_twos = cs_get_option( ‘maintenance_main_typography_two’ );
$font_two = $font_twos[‘family’];
$custom_css = ”

body.maintenance, .maintenance span, .maintenance p, .maintenance input,
.maintenance .main-content h1,
.maintenance button.sub-btn,
.maintenance input[type=\”email\”]#st-email{
font-family: $font_one;
}
.maintenance .subscribe-area h3 {
font-family: $font_two;
}

“;
wp_add_inline_style( ‘maintenance-custom-style’, $custom_css );
}

add_action( ‘wp_enqueue_scripts’, ‘maintenance_inline_style’ );
}
[/php]