Skip Navigation

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;
    
            } 
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>