Skip to content

Commit

Permalink
Update customizer-settings.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jessuppi authored Nov 7, 2024
1 parent 0a1d673 commit 887d4b1
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions inc/customizer/customizer-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,36 @@ function hovercraft_customizer($wp_customize) {
)
) );

// get and format the first font family for google fonts
$first_font_family = get_theme_mod( 'hovercraft_first_font_family', 'noto_sans' );
$first_font_family_final = ucwords( str_replace( '_', ' ', ucfirst( $first_font_family ) ) );

// get and format the second font family for google fonts
$second_font_family = get_theme_mod( 'hovercraft_second_font_family', 'open_sans' );
$second_font_family_final = ucwords( str_replace( '_', ' ', ucfirst( $second_font_family ) ) );

// get and format the third font family for google fonts
$third_font_family = get_theme_mod( 'hovercraft_third_font_family', 'roboto' );
$third_font_family_final = ucwords( str_replace( '_', ' ', ucfirst( $third_font_family ) ) );

// initialize an array for font families with the default option included
$hovercraft_font_families = array(
'' => __( 'Default (Unspecified)', 'hovercraft' ), // always include this as the first option
);

// add each formatted font family to the array if it's not empty or 'none'
if ( ! empty( $first_font_family ) && $first_font_family !== 'none' ) {
$hovercraft_font_families[ $first_font_family ] = $first_font_family_final;
}

if ( ! empty( $second_font_family ) && $second_font_family !== 'none' ) {
$hovercraft_font_families[ $second_font_family ] = $second_font_family_final;
}

if ( ! empty( $third_font_family ) && $third_font_family !== 'none' ) {
$hovercraft_font_families[ $third_font_family ] = $third_font_family_final;
}

// default font family setting
$wp_customize->add_setting( 'hovercraft_default_font', array(
'default' => '',
Expand Down Expand Up @@ -1308,36 +1338,6 @@ function hovercraft_customizer($wp_customize) {
'type' => 'text'
)
) );

// get and format the first font family for google fonts
$first_font_family = get_theme_mod( 'hovercraft_first_font_family', 'noto_sans' );
$first_font_family_final = ucwords( str_replace( '_', ' ', ucfirst( $first_font_family ) ) );

// get and format the second font family for google fonts
$second_font_family = get_theme_mod( 'hovercraft_second_font_family', 'open_sans' );
$second_font_family_final = ucwords( str_replace( '_', ' ', ucfirst( $second_font_family ) ) );

// get and format the third font family for google fonts
$third_font_family = get_theme_mod( 'hovercraft_third_font_family', 'roboto' );
$third_font_family_final = ucwords( str_replace( '_', ' ', ucfirst( $third_font_family ) ) );

// initialize an array for font families with the default option included
$hovercraft_font_families = array(
'' => __( 'Default (Unspecified)', 'hovercraft' ), // always include this as the first option
);

// add each formatted font family to the array if it's not empty or 'none'
if ( ! empty( $first_font_family ) && $first_font_family !== 'none' ) {
$hovercraft_font_families[ $first_font_family ] = $first_font_family_final;
}

if ( ! empty( $second_font_family ) && $second_font_family !== 'none' ) {
$hovercraft_font_families[ $second_font_family ] = $second_font_family_final;
}

if ( ! empty( $third_font_family ) && $third_font_family !== 'none' ) {
$hovercraft_font_families[ $third_font_family ] = $third_font_family_final;
}

// add setting for site name font family
$wp_customize->add_setting( 'hovercraft_site_name_font', array(
Expand Down

0 comments on commit 887d4b1

Please sign in to comment.