Support » Plugin: Query Multiple Taxonomies » Query Multiple Taxonomies AND qTranslate

  • Resolved stare


    I’m strugeling to make this plugin work with the qTranslate plugin!
    Especially with the taxonomy name?

    I addes a custom post type and a taxonomy with qTranslate Tags:

    function post_type_test() {

    // Add new taxonomy, make it hierarchical (like categories)
    $labels = array(
    'name' => _x( '[en:]English[de:]German', 'taxonomy general name' ),

    register_taxonomy('location',array('accommodation'), array(
    'labels' => $labels,
    add_action('init', 'post_type_test');

    The Widget always displays: “[en:]English[de:]German” instead of “English” OR “German”!

    Changing the line 154 in the widget.php file to the following doesn’t help?
    'title' => __(get_taxonomy( $taxonomy )->label),
    Any help is apreciated!

    This changes I made already to add qTranslate functionality:

    widget.php Line 281 change the following to display the taxonomy values in the correct language:

    'name' => $term->name,
    'name' => __($term->name),

    functins.php add the following to add extra Textboxes to edit the values in the chosen languages:

    /* qTranslate for Custom Taxonomy */
    function qtranslate_edit_taxonomies(){
    'public' => true ,
    '_builtin' => false
    $output = 'object'; // or objects
    $operator = 'and'; // 'and' or 'or'

    $taxonomies = get_taxonomies($args,$output,$operator);

    if ($taxonomies) {
    foreach ($taxonomies as $taxonomy ) {
    add_action( $taxonomy->name.'_add_form', 'qtrans_modifyTermFormFor');
    add_action( $taxonomy->name.'_edit_form', 'qtrans_modifyTermFormFor');


    add_action('admin_init', 'qtranslate_edit_taxonomies');

Viewing 2 replies - 1 through 2 (of 2 total)
  • Ok figured it out:

    Change the line 154 in the widget.php file to the following doesn’t help?
    'title' => __(get_taxonomy( $taxonomy )->label),

    and use the following tags:

    'name' => _x( '<!--:en-->English<!--:--><!--:de-->German<!--:-->', 'taxonomy general name' ),

    Congrats to Qian Qin for writing some easily extensible code!

    Here’s a relatively simple way of adding translations your own custom taxonomies. Assuming you’ve registered a taxonomy, ‘my_cat’, add these two lines into qtranslate_hooks.php, near the end of the file around line 244 (search for ‘// Hooks (Actions)’ in the file).

    // Custom Taxonomies
    add_action('my_cat_add_form',		'qtrans_modifyTermFormFor');
    add_action('my_cat_edit_form',		'qtrans_modifyTermFormFor');

    That will add the translation fields in the admin pages for your custom category.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Query Multiple Taxonomies AND qTranslate’ is closed to new replies.