跳过导航

Open

Topic Tags: Compatibility

Overview of the issue

When using the ColorMag theme with WPML, the colors assigned to categories in Appearance → Customize → Global → Category Colors are only applied to the default language.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open: /wp-content/themes/colormag/inc/template-tags.php
  • Look for line 141
  • Replace:
    foreach ( $category as $category_list ) {
    
                $color = get_theme_mod( 'colormag_category_color_' . $wp_category_id );
    
                return $color;
    
            }
    
  • With:
    foreach ( $category as $category_list ) {
    
                // WPML workaround for compsupp-7690 
                $my_default_lang = apply_filters('wpml_default_language', NULL );
                $wp_category_id = apply_filters( 'wpml_object_id', $wp_category_id, 'category', TRUE, $my_default_lang );
    
                $color = get_theme_mod( 'colormag_category_color_' . $wp_category_id );
    
                return $color;
    
            } 
    

留下回复

紧扣主题并尊重他人。如果您需要帮助解决与本帖无关的问题,请使用我们的 Support Forum 开始聊天或提交票据。

您可以使用这些标签:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>