Titles in my sidebar widget appear in all languages – with qtranslate

Hi Will also try this: Add this to your functions.php function get_qTrans_TitleText($text) { $language=qtrans_getLanguage(); preg_match(‘/<!–:’.$language.’–>(.*?)<!–:–>/’, $text, $matches); return strip_tags($matches[0]); } And then: <?php echo get_qTrans_TitleText($text); ?> Have no Idea what version of qTranslate and WP you have so you may even use __() to get the correct title or _e() to echo it.

Difference between bloginfo(‘home’) and home_url() and site_url()

The difference in your case is in filters being applied to output of these functions. While bloginfo applies one of these filters: if ( ‘display’ == $filter ) { if ( $url ) $output = apply_filters(‘bloginfo_url’, $output, $show); else $output = apply_filters(‘bloginfo’, $output, $show); } Function home_url applies this filter: return apply_filters( ‘home_url’, $url, $path, … Read more

Adding a filter to qTranslate to change display of language chooser

In my header.php, where I want qTranslate language chooser to live, I put this in: <?php echo qtrans_SelectCode(‘code’);?> Then, I added this code to functions.php. It’s a little redundant in that it repeats the built-in qTranslate options (image, text, dropdown) which I am not using on my page – but I wanted to retain the … Read more

How to force WordPress to temporarily switch locale (using qTranslate)? [closed]

And I got it. What was missing was re-loading the text domain for WooCommerce, that was loaded with the current locale at initialization: // set the current locale and send email with it active unload_textdomain(‘woocommerce’); setlocale(LC_ALL, $new_locale); global $q_config, $locale, $woocommerce; $locale = $new_locale; $q_config[‘language’] = substr($new_locale, 0, 2); $woocommerce->load_plugin_textdomain(); global $wc_cle_wc_email; $wc_cle_wc_email->customer_completed_order($order_id); // set … Read more

qTranslate get content by language [closed]

You must use the qTranslate native functions to do your job. Use qtrans_use, that is the function that do all the job in qTranslate. It’s defined in qtranslate_core.php, line 747 function qtrans_use($lang, $text, $show_available=false) Use it on the raw content of the post! Try this code: <?php $id=47; $post = get_page($id); $content = qtrans_use(‘en’, $post->post_content,false); … Read more