0

I'm using WPML for multi-language website. It works really well except for custom taxonomies.

In admin, I can only join foreign posts to foreign taxonomies (which is exactly what it should do) but on the public area, when retrieving taxonomies it seems that the current language is ignored: I get all taxonomies.

Any help would be greatly appreciated !

Thanks.

1

hack for filter the_terms:

$terms = get_terms('YOUR-TAXONOMY','hide_empty=1' );
if (!empty( $terms )){
  $term_links = "";
  foreach ( $terms as $term ) {
  if($term->term_id == icl_object_id($term->term_id,'YOUR-TAXONOMY',false,ICL_LANGUAGE_CODE)){
    $term_links[] = '<li><a href="'.$category_url.'?YOUR-TAXONOMY='. $term->slug.'">
     ' . $term->name . '' . $term->name . '</a></li>';
  }
  }
echo join( '', $term_links );
}
0

I found out that when retrieving the taxonomy you have to do this :

    $args = array(
        'hide_empty' => true,
        'taxonomy' => 'projet_thematique'
    );
    $thematiques = get_terms('projet_thematique', $args);

The thing was done by adding the 'taxonomy' as an argument as well.

I hope it will be usefull for others ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.