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.  

Strange behavior with a redirect loop – involves WPML multi-language plugin

Your site is misconfigured, but from remote it’s not easy to say where exactly. For the redirects, it’s going this way: requesting 301 redirect to requesting 301 redirect to requesting go to 2. This is the redirect loop your page creates unrolled. To debug this, you can make use of …

Read more

Cannot locate specific link/string using String Translation with WPML? [closed]

You need to put your strings in translatable format. <a href=””><?php _e( ‘Link’, ‘your-theme-text-domain’); ?></a> Function reference: _e(), this one echoes the value, for assignment, use $my_string = __( ‘String’, ‘text-domain’ );. Also, check the following documentation: WordPress_in_Your_Language#Introduction and WPML – Getting String Translation to Work.