Breadcrumb NavXT and WPML Compatibility

In the past two days, I took the time to investigate possible compatibility issues between Breadcrumb NavXT and WPML. Within Breadcrumb NavXT, every attempt is made to use the WordPress API, when possible, to maximize the compatibility with other plugins such as WPML. Occasionally, this is not enough and the findings of this investigation are presented in this article.

What You Need

These are the plugins and versions used when performing the testing reported on within this article:

  • WPML Multilingual CMS (affiliate link)- At the time this article was written, 3.1.5 was the latest available version and was the version tested against.
  • WPML String Translation – At the time this article was written, 2.0.5 was the latest available version and was the version tested against. At the time of this writing, this came as part of purchasing WPML Multilingual CMS, and is not part of WPML Multilingual Blog.
  • Breadcrumb NavXT – Tested against a development release of 5.1.0.

What Works

Out of the box, just about anything that is supported by WordPress core works. This includes: pages, posts, categories, tags, custom taxonomies, and basic Custom Post Types.

What Doesn’t Work

Breadcrumb NavXT Deficiencies

Any string saved in the Breadcrumb NavXT settings page (e.g. search results) will not be translated by WPML. Support for this requires an extension plugin for Breadcrumb NavXT. Additionally, it has been reported several times, and verified that Custom Post Type root pages don’t translate. Again, this requires an extension plugin for Breadcrumb NavXT to fix. A preliminary version of this extension plugin, Breadcrumb NavXT WPML Extensions, is ready for beta testing. Release details will be forthcoming.

Lastly, the included Breadcrumb NavXT widget has two issues. First, the widget title can’t be translated by WPML in versions of Breadcrumb NavXT below 5.1.0 (bug was discovered and fixed in this activity). Likewise, the “Text to show before the breadcrumb trail” setting was not run through a filter prior to version 5.1.0. However, it appears for the “Text to show before the breadcrumb trail” setting, a little something extra will be required. Naturally, this will be in the Breadcrumb NavXT WPML Extensions plugin.

WPML Deficiencies

Slug translation for Custom Post Types does not seem to work correctly. After trying several different methods, it appears it doesn’t work at the moment. Additionally, translation of Custom Post Type archive page names does not work, this appears to be a WPML defect. The workaround at the moment appears to be using the icl_translate() function in a manner similar to how it was discussed in this forum post. Except, rather than using it on the has_archive property, use it on the various labels for the Custom Post Type.

Where Does That Leave Us?

For the vast majority of users of WPML and Breadcrumb NavXT, an extensions plugin is going to be required. Said plugin has been written as part of this exercise. It needs some additional testing and details on its release will follow later this week. That said, for things to work perfectly, it looks like WPML has a defect that is in the process of being fixed.

Update: Breadcrumb NavXT WPML Extensions is now available.

-John Havlik

[end of transmission, stay tuned]

6 thoughts on “Breadcrumb NavXT and WPML Compatibility

    • Yes, now that Breadcrumb NavXT Menu Magic has been released, Breadcrumb NavXT Title Trixx and Breadcrumb NavXT WPML Extensions are next up for release. Title Trixx needs to be retested and a feature added before release. WPML Extensions needs to be tested and documented before release. The current goal is to release both extensions before July 1, 2014. Both will be premium extensions.

      -John Havlik

      • Hi John
        Thanks for your feedback.
        For the meantime I found a hack and changed line 685 in class.bcn_breadcrumb_trail.php to this:
        // WPML - get translated CPT slug
        $cpt_archive_link = get_post_type_archive_link($type->post_type);
        if ( function_exists( 'icl_translate' ) ) {
        $translated_slug = icl_translate('wpml_custom', 'wpml_custom_'.$type->post_type, $type->post_type);
        if ($translated_slug != '') {
        $cpt_archive_link = home_url( user_trailingslashit( $translated_slug, 'post_type_archive' ) );
        }
        }
        $breadcrumb = $this->add(new bcn_breadcrumb($this->post_type_archive_title(get_post_type_object($type->post_type)), $this->opt['Hpost_' . $type->post_type . '_template'], array('post', 'post-' . $type->post_type . '-archive'), $cpt_archive_link));

        Cheers,
        Aldo

  1. Hi

    I use a polylang plugin to translate my entire website. For breadcrumbs I use the “Breadcrumb NavXT” which generally I need for my portfolio gallery with categories. I spotted that portfolio does not work with on a multilingual website however categories work fine, then I searched and found your “Breadcrumb NavXT and WPML Compatibility” extension, I need to ask you if the extension is compatible with polylang plugin?

    Thank you,
    Dorota

    • Dorota,

      The Breadcrumb NavXT WPML Extensions plugin only supports the WPML Multilingual CMS plugin (it is by far the most popular multi language plugin for WordPress). Depending on how Polylang works, it may be just as compatible with Breadcrumb NavXT as WPML is without the Breadcrumb NavXT WPML Extensions plugin.

      -John Havlik

Leave a Reply

Your email address will not be published. Required fields are marked *