首页 > 解决方案 > 获得最多 3 个变量的输出

问题描述

我需要帮助。我有 3 个设置,每个设置都有几个不同的值。如您所见,我有 3 个 $font_weight 设置。

$font_weight 有 3 个输出值。

$font_weight2 有 2 个输出值。

$font_weight3 有 2 个输出值。

入队的 CSS 文件命名如下,例如“open_sans400.css”。

我希望你明白我的意思。如果您不明白,请提出问题,以便我们找到解决方案

function fonts() {
    $font_family = get_theme_mod('font_body', 'open_sans');
    $font_weight = get_theme_mod('font_weight', 400);
    $font_weight2 = get_theme_mod('font_weight2', 700);
    $font_weight3 = get_theme_mod('font_weight3', 400);

    if ( // if $font_weight took a value ) {
        $font_weight_c = // what is value between ( 400, 700, 800 );
    } elseif ( // if $font_weight2 took a value ) {
        $font_weight_c = // what is value between ( 400, 500 );
    } elseif ( // if $font_weight3 took a value ) {
        $font_weight_c = // what is value between ( 500, 700 );
    }

    wp_enqueue_style( 'fonts-css', '//site.com/fonts/'. $font_family.$font_weight_c .'.css', array(), null, 'screen' );
}

标签: phpwordpresstheme-customizer

解决方案


推荐阅读