Hi,
First of all I like to thank you for your hard work. Everything is great!
I am using qtranslatex. And I am having a issue about the category description translation. I guess it is compatibility problem but I’ll be thankful if you guys help me out.
So I created categories and translated the title and the category descriptions in 2 languages using qtranslatex. When I click the category on header menu, the category page shows the title in one languge but the description shows both with language indicators.
Here is how it exactly looks:
HEALTH AND NATURE
[:tr]Beden ve Dünya İyileştirme[:en]Body and Earth Recovery[:]
How can I make it pick one for the language chosen?
I mean just title and description in one language:
HEALTH AND NATURE
Body and Earth Recovery
I hope I could explain it. By the way I have checked almost everywhere couldnt find a solution. I have added some codes to functions.php last line:
<?php
$category = get_the_category();
_e($category[0]->category_description, ‘qtranslate’);
?>
It crashed my website. Thankfully I backed it up. Now it’s all good except this category description language problem.
It is probably a easy thing to solve but it’s been a nightmare for me. So any help is much appreciated. Thank you in advance!
Hi,
this might not be the best way to do it but it’s how I have it working in my website:
file /wp-content/themes/Newspaper/includes/wp_booster/td_category_template.php
replace this:
protected function get_description() {
if (!empty($this->current_category_obj->description)) { // is needed?
return '<div class="td-category-description"><p>' . $this->current_category_obj->description . '</p></div>';
}
}
with this:
protected function get_description() {
if (!empty($this->current_category_obj->description)) { // is needed?
if (function_exists( 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' )){
return '<div class="td-category-description"><p>' . qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($this->current_category_obj->description) . '</p></div>';
} else {
return '<div class="td-category-description"><p>' . $this->current_category_obj->description . '</p></div>';
}
}
}
Remember this will disappear after a theme update, but tagDiv people will likely add compatibility for this in the mean time.
Hope this helps, cheers!