Photolux Grid Gallery and the qTranslate plugin
The qTranslate plugin requires a few modifications in the theme code when the content is loaded dynamically with AJAX, so that the correct translated version is retrieved.
The gallery in Photolux loads the content with AJAX and it will require the following modifications to be applied in order to make the plugin load the selected translation:
1. Modify line 86 of the template-grid-gallery.php file:
"ajaxUrl":"<?php echo admin_url( 'admin-ajax.php' ); ?>",
to be like this:
"ajaxUrl":"<?php echo admin_url('admin-ajax.php?lang='.qtrans_getLanguage()); ?>",
2. For the title and category names in the gallery page in the lib/functions/ajax.php file modify line 42:
$new_post['title'] = $post->post_title;
to be like this:
$new_post['title'] = __($post->post_title);
– in the same file modify line 61:
$term_names[]=$term->name;
to be like this:
$term_names[]=__($term->name);
3. For the slider title and content, in the same ajax.php file modify line 117:
$res_arr['content']=do_shortcode(apply_filters('the_content', $content));
to be like this:
$res_arr['content']=do_shortcode(apply_filters('the_content', __($content)));
and also line 127:
$res_arr['title']=$post->post_title;
to be like this:
$res_arr['title']=__($post->post_title);
and for the category in the slider you have to modify line 122:
$term_names[]=$term->name;
to be like this:
$term_names[]=__($term->name);
4. For the filter you can modify line 68 of the template-portfolio-gallery.php file:
$cat_arr[]=array("id"=>$cat->term_id, "name"=>$cat->name);
to be like this:
$cat_arr[]=array("id"=>$cat->term_id, "name"=>__($cat->name));
Regarding translating categories – you can use the qTranslate quick tags – for example, if you have an English category and a French translation, you can insert the following text in the category title:
<!--:en-->English category<!--:--><!--:fr-->French Category<!--:-->
OR:
[:en]English category [:de]French category