wpml and languages with different directions

Could not found why the is_rtl() is not working properly, but found that wpml_is_rtl is doing it’s own job, so by adding this code to theme’s functions.php everything seems to work fine: if ( apply_filters( ‘wpml_is_rtl’, null) ) { mu_fix_is_rtl(true); }else { add_filter(‘language_attributes’,’mu_alter_language_attributes’); mu_fix_is_rtl(false); } function mu_alter_language_attributes($output, $doctype){ return str_replace(‘rtl’,’ltr’,$output); } function mu_fix_is_rtl($rtl){ global $wp_locale; … Read more

How to translate text in function.php with WPML [closed]

It should suffice to add a __() around your translatable text: add_action( ‘woocommerce_cart_calculate_fees’, ‘custom_handling_fee’, 10, 1 ); function custom_handling_fee ( $cart ) { if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) return; if ( ‘cod’ === WC()->session->get(‘chosen_payment_method’) ) { $fee = 10; $cart->add_fee( __(‘Cash On Delivery’), $fee, true ); } } You can then … Read more

Where are comment ratings stored?

As stated in the comments below the question, Comments don’t have ratings in WordPress I went on and inspected the HTML source for one of my posts and figured out which plugin generated the rating based on the CSS class name. I should have known better. The plugin is Tasty Recipes by WP Tasty. I … Read more

WPML best page selector with php

This code returns the post ID in the current language. $translated_post_id = apply_filters( ‘wpml_object_id’, $post_id, ‘post’ ); So, you can use $translated_post_id in is_page. Documentation.