【问题标题】:Warning: Illegal string offset 'face' in Wordpress Blackfyre警告:Wordpress Blackfyre 中的非法字符串偏移 'face'
【发布时间】:2015-11-11 20:26:57
【问题描述】:

这是我正在使用的代码 -

if ( !function_exists( 'blackfyre_options_typography_google_fonts' ) ) {
    function blackfyre_options_typography_google_fonts() {
        $all_google_fonts = array_keys( blackfyre_options_typography_get_google_fonts() );
        // Define all the options that possibly have a unique Google font
        $google_font = of_get_option('google_font', 'Rokkitt, serif');
        $google_mixed = of_get_option('google_mixed', false);
        $google_mixed_2 = of_get_option('google_mixed_2', 'Arvo, serif');
        // Get the font face for each option and put it in an array
        $selected_fonts = array(
            $google_font['face'],    - 1035 line
            $google_mixed['face'],   
            $google_mixed_2['face'] );   - 1037 line
        // Remove any duplicates in the list
        $selected_fonts = array_unique($selected_fonts);
        // Check each of the unique fonts against the defined Google fonts
        // If it is a Google font, go ahead and call the function to enqueue it
        foreach ( $selected_fonts as $font ) {
            if ( in_array( $font, $all_google_fonts ) ) {
                blackfyre_options_typography_enqueue_google_font($font);
            }
        }
    }
}

这些是我收到的错误消息 -

警告:第 1035 行 /home/imposing/public_html/wp-content/themes/blackfyre/functions.php 中的非法字符串偏移 'face'

警告:第 1037 行 /home/imposing/public_html/wp-content/themes/blackfyre/functions.php 中的非法字符串偏移 'face'

我需要帮助来解决此错误和/或指出正确的方向。

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    我遇到了同样的问题,就像我在之前的评论中所说的那样,我通过将 extra-functions.php 第 105 - 107 行中的代码更改为:

    $selected_fonts = array(
     $google_font,
     $google_mixed,
     $google_mixed_2 );
    

    如发现 Illegal string offset Warning in Wordpress

    我希望这也能为你解决。

    干杯。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-30
      • 2013-09-13
      • 2013-04-11
      • 2012-04-09
      相关资源
      最近更新 更多