This theme is using the wp_style_add_data function to manipulate the stylesheet paths for rtl languages. One drawback to this approach is that it assumes the child theme will have a style-rtl.css file.
I admit the CTC does not fully support this implementation; however, a workaround would be to add these lines to your child theme functions.php file (after the auto-generated code):
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_rtl', 20 );
function chld_thm_cfg_rtl(){
wp_enqueue_style( 'chld_thm_cfg_parent_rtl', trailingslashit( get_template_directory_uri() ) . 'style-rtl.css' );
wp_enqueue_style( 'chld_thm_cfg_child', trailingslashit( get_stylesheet_directory_uri() ) . 'style.css' );
}
This maintains the child theme style.css file as primary stylesheet (where you can add any rtl overrides) and keeps the parent rtl as the baseline.
Hope this helps.
Thanks a lot for quick response and I wish to make CTC support this kind of implementation because there are many famous themes using it.
Personally I don’t want to use the above workaround until CTC supports it because I don’t want to make my website unstable.
Adding a single hooked function will not make your site unstable, but that is your call.
This goes to one’s philsophy of stylesheet inheritance. CTC was built on the assumption that the child theme only needs to provide “override” styles to enhance the existing stylesheets. As such, RTL styles are just overrides to the default styles.
The wp_style_add_data approach assumes the entire stylesheet will be replaced for rtl languages, which I do not believe is necessary. However I have seen just as many if not more themes add a single rtl override stylesheet that inherits the default stylesheet. In other words, load style.css and if_rtl(), then load the rtl stlesheet after.
That said, if presented with a solid argument for it, I may implement additional logic in the analyzer.
There definitely needs to be some changes to support the wp_style_add_data manipulation, because it is causing the analyzer to return links as “unregistered” when they are being run through the filter.
So, whether I like it or not, you can expect this to be addressed in a near future release.