Title: MLA   WPML
Last modified: August 24, 2016

---

# MLA WPML

 *  Resolved [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/mla-wpml/)
 * I use WPML plugin to translate content.
 * There are two problems:
    - Tag cloud [displays](http://fresh-trip.ru/fotoalbomy/) all language versions
      of taxonomies.
    - When I assign a “Att. category” it is not synchronized with other language
      version of photo. This happens even if I create a second language version 
      of the photos after the appointment “Att. category”.
 * [https://wordpress.org/plugins/media-library-assistant/](https://wordpress.org/plugins/media-library-assistant/)

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989634)
 * Thank you for this report. I have reproduced both of your problems in my WPML
   test system.
 * WPML has features for managing taxonomy term translations and for using language-
   specific terms with posts and pages. However, I do not believe it has any capability
   for managing term assignments for Media Library items such as photos.
 * I will work on both of your problems for a future MLA version, and I will post
   an update to this topic when I have progress to report. Thanks for your patience
   while I see what can be done.
 *  Thread Starter [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989635)
 * Thank you!
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989703)
 * I have just uploaded a new Development Version that contains two WPML-related
   enhancements:
    1. The `[mla_tag_cloud]` now displays only the terms for the current language when
       WPML is active.
    2. The Media/Assistant submenu table displays a Language column when WPML is active
       and “All Languages” is selected in the admin toolbar.
 * I am working on the term-synchronization issue, your second problem, and some
   other WPML enhancements.
 * You can find step-by-step instructions for using the Development Version in this
   earlier topic:
 * [MLA errors when using plugin](https://wordpress.org/support/topic/mla-errors-when-using-plugin)
 * I will leave this topic unresolved until the new features are released in the
   next MLA version. If you get a chance to try the Development Version, let me 
   know if it meets your needs. Thanks for your interest in the plugin.
 *  Thread Starter [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989704)
 * My friend helped me with customization.
    I did not want to write in this thread
   so far, before all do not work the way I wanted. But once you have the new version,
   I’ll write what has been accomplished:
    - we went back to the conclusion of categories through a file taxonomy.php
    - I put you code with class walker in function.php:
 *     ```
       /**
        * Class MNA_Pad_Counts_Walker adds accurate, padded attachment counts to taxonomy terms.
        *
        * Class Walker is defined in /wp-includes/class-wp-walker.php
        * Class Walker_Category is defined in /wp-includes/category-template.php
        */
       class MNA_Pad_Counts_Walker extends Walker_Category {
           /**
            * MLA Terms
            *
            * @var array
            */
           public $mla_terms = array();
   
           /**
            * Constructor - set the MLA Terms.
            *
            * @param string Taxonomy name/slug.
            */
           function __construct( $taxonomy ) {
               $attr = array (
                   'taxonomy' => $taxonomy,
                   'pad_counts' => 'true',
               );
               $terms = MLAShortcodes::mla_get_terms( $attr );
               unset( $terms['found_rows'] );
   
               foreach ( $terms as $term ) {
                   $this->mla_terms[ $term->term_taxonomy_id ] = $term->count;
               }
           }
   
           /**
            * Start the element output.
            *
            * @see Walker::start_el()
            *
            * @param string Passed by reference. Used to append additional content.
            * @param object Taxonomy data object.
            * @param int    Depth of category in reference to parents. Default 0.
            * @param array  An array of arguments. @see wp_list_categories()
            * @param int    ID of the current category.
            */
           function start_el( &$output, $taxonomy_object, $depth = 0, $args = array(), $id = 0 ) {
   
               if ( isset( $this->mla_terms[ $taxonomy_object->term_taxonomy_id ] ) ) {
                   $taxonomy_object->count = $this->mla_terms[ $taxonomy_object->term_taxonomy_id ];
               }
   
               parent::start_el( $output, $taxonomy_object, $depth, $args, $id );
           }
       }// Class MNA_Pad_Counts_Walker
       ```
   
    - I put this function in function.php:
 *  -     ```
          function mla_ul_li_function() {
          echo('<ul>');
          wp_list_categories( array(
           'taxonomy'     		=> 'attachment_category',
           'hierarchical'  		=> 1,
           'hide_empty'    		=> 1,
           'pad_counts'    		=> 1,
           'show_count'    		=> 1,
           'title_li'      		=> '',
           'use_desc_for_title'	=> 1,
           'walker'        => new MNA_Pad_Counts_Walker( 'attachment_category'),
          ) );
          echo('</ul>');
          }
          add_shortcode( 'mla_ul_li', 'mla_ul_li_function' );
          ```
      
 *  - In taxonomy.php I put this code:
 *     ```
       $is_media_archive = in_array( $wp_query->query_vars['taxonomy'], array( 'attachment_category', 'attachment_tag' ) );
       if ( $is_media_archive ) {
       	if ( isset( $_REQUEST['use_mla_gallery'] ) ) {
       		$use_mla_gallery = true;
       	} else {
       		$use_mla_gallery = false;
       		$args = array_merge( $wp_query->query_vars, array( 'post_type' => 'attachment', 'post_status' => 'inherit' ) );
       		query_posts( $args );
       	}
       }
       ```
   
    - Also in taxonomy.php I put this code:
 *     ```
       echo do_shortcode('[mla_ul_li]');
   
       //categorys
       $mla_link_attributes = sprintf( 'data-imgid="%1$s" data-postid="%2$s"', $data_imgid, $data_postid );
       $mla_caption = "<a class=\"imgBook\" rel=\"bookmark\" title=\"".sprintf (__('Discussion and a permalink to the photo','galeria-fs'))."\" href=\"{+pagelink_url+}\"><div class=\"galleria-link-bookmark\"></div></a>{+excerpt+}";
   
       //pagination
       echo '<div class="page-link"><span class="b" style="float: left;">'. __( 'Pages:', 'mantra' ).'</span>'.do_shortcode( sprintf( '[mla_gallery %1$s="%2$s" posts_per_page="60" mla_output="paginate_links" mla_link_href="%3$s?"]', $wp_query->query_vars['taxonomy'], $wp_query->query_vars['term'], $wp_query->query_vars['page_url'] )).'</div>';
   
       //photos
       echo do_shortcode( sprintf( '[mla_gallery %1$s="%2$s" mla_caption=\'%3$s\' mla_link_attributes=\'%4$s\' link="file" posts_per_page="60"]', $wp_query->query_vars['taxonomy'], $wp_query->query_vars['term'], $mla_caption, $mla_link_attributes) );
       ```
   
 * This solution is allowed to create a [structured list of categorys](https://wordpress.org/support/topic/structured-list-of-tags).
   And attachment_category displays only for current language versions.
 * You can see how it’s working [here](http://fresh-trip.com/attachment_category/marine-fauna/).
 * Now, if I update parameters photographs (for example, change the title), the 
   language categories synchronized (but only for this photo). I do not know how
   it happened, I did not change anything else:-)
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989706)
 * Thank you for your update, and for taking the time to work through the “structured
   list of categories” topic and implementation with your developer friend. The 
   results in your “marine fauna” page look great!
 * You wrote “**_And attachment\_category displays only for current language versions_**”–
   are you using the Development Version I uploaded on 22 April?
 * I am not quite sure what you mean by “**_if I update parameters photographs (
   for example, change the title), the language categories synchronized (but only
   for this photo)._**“, but I have not yet made any changes for term synchronization.
 * I have just uploaded a **new Development Version (dated 20150426)** that contains
   another WPML-related enhancement:
    1. The Media/Assistant submenu table displays a “language management” column when
       WPML is active. This lets you easily see the translation status of all items
       and to add or edit translations in any active language, even if the item is 
       not attached to a post or page.
 * I am still working on the term-synchronization issue, your second problem.
 * You can find step-by-step instructions for using the Development Version in this
   earlier topic:
 * [MLA errors when using plugin](https://wordpress.org/support/topic/mla-errors-when-using-plugin)
 * I will leave this topic unresolved until the new features are released in the
   next MLA version. Please take some time to try the new Development Version and
   let me know if it meets your needs. Thanks for your help with this topic.
 *  Thread Starter [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989707)
 * > You wrote “And attachment_category displays only for current language versions”–
   > are you using the Development Version I uploaded on 22 April?
 * Now — Yes. But before the upgrade, with the above-described method, the problem
   disappeared.
    ——–
 * > I am not quite sure what you mean by “if I update parameters photographs (for
   > example, change the title), the language categories synchronized (but only 
   > for this photo).”, but I have not yet made any changes for term synchronization.
 * For example:
    There is a photograph attached to Russian categories “[Транспорт](http://fresh-trip.ru/attachment_category/transport-ru/)/
   [Воздушный](http://fresh-trip.ru/attachment_category/vozdushnyj/)“. But this 
   photo is not attached to the corresponding English categories (because I attached
   a photo to the Russian categories before to create the appropriate English). 
   Then I created the English categories “Transport / Air” and linked it with the
   Russian category “Транспорт / Воздушный”, using WPML plugin. Then I opened the
   photo & clicked “update”. The photo is automatically attached to English categories“
   [Transport](http://fresh-trip.com/attachment_category/transport/) / [Air](http://fresh-trip.com/attachment_category/air/).”
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989708)
 * Thank you for responding to my questions with the additional information about
   your application.
 * I believe the first answer regarding the “above-described method” makes sense.
   You are using the WordPress `wp_list_categories()` function to get the category
   list. WPML will intercept the database queries made by this function and return
   language-specific results. You are using `mla_get_terms()` to get term-specific
   counts. The MLA production version will return counts for all languages, but 
   your Walker will only access the counts it needs. Using the Development Version
   will give you language-specific counts. This is somewhat more efficient, but 
   you will not notice any difference in the displayed output.
 * Your second answer regarding term synchronization puzzles me. I have tried to
   do the steps you describe on my test system, but “opening the photo and clicking
   update” does not automatically assign the terms from one language to another.
 * I would like to continue this dialog by e-mail, which will be easier and more
   productive. If you send me your contact information I will reply with a more 
   detailed explanation of my testing and results. You can use the Contact Us page
   at the FTJ web site:
 * [Fair Trade Judaica/Contact Us](http://fairtradejudaica.org/our-story/contact-us/)
 * Thanks for working with me on this issue. I know the WPML improvements will be
   of use to many MLA users.
 *  Thread Starter [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989709)
 * I can’t see you site, because: “Forbidden – Users from your country are not permitted
   to browse this site.”
    So write to my email: k a r a s t e l ((at)) gmail.com
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989710)
 * I regret that you were unable to access the FTJ site. The site has suffered from
   a number of hack attempts over the years and our only defense is preventing access
   to the site from the countries where the attacks originate. I hope you understand
   it is the best we could do.
 * I will write you at the address you have provided. Thanks for your help and understanding.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989711)
 * I regret that you were unable to access the FTJ site. The site has suffered from
   a number of hack attempts over the years and our only defense is preventing access
   to the site from the countries where the attacks originate. I hope you understand
   it is the best we could do.
 * I will write you at the address you have provided. Thanks for your help and understanding.
 *  Thread Starter [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989720)
 * Did you receive my letters? I am afraid that your defense can not miss them, 
   or I got into spam))
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989721)
 * Yes, I got your messages. Did you receive anything from me? I sent two replies.
 *  Thread Starter [Karastel](https://wordpress.org/support/users/karastel/)
 * (@karastel)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/mla-wpml/#post-5989722)
 * I received 2 letters from you. Answered both. In the answer received nothing.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [11 years ago](https://wordpress.org/support/topic/mla-wpml/#post-5989741)
 * Thank you for working with me offline to develop and test several WPML fixes 
   and enhancements.
 * I have just uploaded a new Development Version dated 20150531 which has my “release
   candidate” version of the new WPML support.
 * You can find step-by-step instructions for using the Development Version in this
   earlier topic:
 * [MLA errors when using plugin](https://wordpress.org/support/topic/mla-errors-when-using-plugin)
 * If you get a chance to try the latest Development Version, let me know if there
   are any problems or further work required. Thanks for your help on these important
   new features.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/mla-wpml/#post-5989744)
 * I have released MLA version 2.11. It contains enhanced WPML support and provides
   the features you need.
 * I am marking this topic resolved, but please update it if you have problems or
   further questions about WPML support in MLA. Thanks for your interest in the 
   plugin.

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘MLA WPML’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [mla](https://wordpress.org/support/topic-tag/mla/)

 * 15 replies
 * 2 participants
 * Last reply from: [David Lingren](https://wordpress.org/support/users/dglingren/)
 * Last activity: [10 years, 12 months ago](https://wordpress.org/support/topic/mla-wpml/#post-5989744)
 * Status: resolved