WPML
Status
Resolved by author
Related plugin/theme
ColorMag Pro
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;
    
            } 

All known issues →