Photolux Grid Gallery and the qTranslate plugin

Please Note: Theme customizations and third party plugin support go beyond the scope of our support services and this article is provided solely as a courtesy to our customers. Please take a moment to review the Scope of our Support.

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:


to be like this:


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:


to be like this:


and for the category in the slider you have to modify line 122:


to be like this:


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<!--:-->


[:en]English category [:de]French category

Was this useful? 0