Questions Tags Users Unanswered

Qtranslate

Question is open.
3 answers (2 voices) (10K views)
Copy from Envato as you suggested.

Hi. Congratulations fot this extensive great work. I have a big problem with it, mostly my work shoul have multilanguage suport and i use qtranslate. The thing is the categories in the theme doesn’t seem to accept the multilanguaage, while the taxonomies do. that means that all the content works in mutilanguage but when trying to acced through a category link in a widget or in “read more” just shows the main language post, portfolio..what ever.
Can you thing in a solution?, or maybe there is and i didn’t find it i notice this problem once the theme has been aproved by the client, so mostly of the work is done, and as you may imagine, going back to the ckient and tell them that we should change theme is not a nice idea.

see you.
3 Answers
hi,
Need to look further, but seems to work, thank you very much.
Great!

:)

Still a question, is there a way to ad translations to categories?, in other themes qtranslate does ad title fields for any category, that will be a good help.

Thank you for the faster and good answer.
I've edited my answer. - Dottoro -
Hi,

I think, I found what causes the problem. The qtranslate plugin does not support custom post types, that’s why the URLs of news and portfolio posts, categories and tags point to the english version of these pages.

To fix this, just paste these lines into the functions.php of your child theme:


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
add_filter ('post_type_link', 'qtrans_convertURL', 15);

remove_filter ('term_link', 'qtrans_convertURL');
add_filter ('term_link', 'qtrans_convertURL', 15);

remove_filter ('day_link', 'qtrans_convertURL');
add_filter ('day_link', 'qtrans_convertURL', 15);

remove_filter ('month_link', 'qtrans_convertURL');
add_filter ('month_link', 'qtrans_convertURL', 15);

remove_filter ('year_link', 'qtrans_convertURL');
add_filter ('year_link', 'qtrans_convertURL', 15);

The first line (post_type_link) is for links pointing to news and portfolio posts (such as 'read more').

The other lines are required because the qtranslate plugin modifies the URLs of tags, categories and dates too earlier. To fix this, the qtrans_convertURL function must be 'rehooked' with a higher priority (15 instead of the original 10).

The qtranslate plugin allows you to set language dependent names for tags and categories. Since the qtranslate plugin does not support custom post types and the tags and categories are post type dependent in the theme, so this qtranslate feature does not work for news and portfolio tags and categories.

To fix this, just paste these lines into the functions.php of your child theme:

1.
2.
3.
4.
5.
6.
7.
8.
9.
add_action('news_categories_add_form',      'qtrans_modifyTermFormFor');
add_action('news_tags_add_form',            'qtrans_modifyTermFormFor');
add_action('news_categories_edit_form',     'qtrans_modifyTermFormFor');
add_action('news_tags_edit_form',           'qtrans_modifyTermFormFor');

add_action('portfolio_categories_add_form',     'qtrans_modifyTermFormFor');
add_action('portfolio_tags_add_form',           'qtrans_modifyTermFormFor');
add_action('portfolio_categories_edit_form',    'qtrans_modifyTermFormFor');
add_action('portfolio_tags_edit_form',          'qtrans_modifyTermFormFor');


If you don't use a child theme yet, please see Child Themes in the theme documentation.

If you need more information, feel free to ask, but please use our support forum for Studio theme related questions.
15 30 50 per page

Your Answer

Limit of files to attach: 3 / Max total size: 1024 KB
File:
Description:
remove