Pro and WPML : solution proposals

Now it is becoming very (too) long!
Any expected release date yet?

Hi there,

There is no exact date for ETA, I’ll let you know if I got something :wink:

Thanks.

This is just not acceptable.
We are not talking about an open source theme.
We are customers, we have paid for it!
Telling me “I’ll let you know” is not an answer…
We are professionals, we need an ETA.
Is it a questions of days, weeks, months???

1 Like

Hi there,

We’re not told about the ETA and I’m not really sure. But I’m pretty sure that our developers are already working on this issue because this is one of the big parts of the upcoming updates. I only said “I’ll let you know” IF I personally get some news about it. Then I shouldn’t do that, let’s wait for official announcement as I’m eager to see and test it too :slight_smile:

Thanks for understanding.

Hi, I agree with @tixeo I demand an ETA :frowning:

Hi dear @spi,

We already have an article regarding the implementation recommendation and you already commented and gave your insight there.

Sure thing as our development team mentioned in the article they are doing their best.

Rest assured that we will announce the ETA as soon as we have more information from our development team.

Thank you for your follow up.

Kyle chimed in recently on this point over on that thread.

1 Like

Hi Alexander, as I understood correctly the same issues apply to X as well? If not I’d formally request a license change from Pro to X. We are heading into October now and no update has been released yet. The issue has been put forward (but has been existing already longer) on the 2nd of August. So, enough, I need to get on with my business. Thnx

1 Like

Hi there,

The WPML works correctly if you set the language mode in WPML from parameter mode to directory mode.

Using that workaround you can translate whatever you have in the content and Pro Builder.

The one that is in question is the Header/Footer Builder and how to implement the WPML functionality there.

If you still need to change the license kindly open up a separate thread and we will follow up the case with you.

Thank you.

Well, at least with me it is not. Having made two pages they aren’t visible whatsoever. I’ll open a separate thread for the license change.

We’ll be happy to assist you with that @Zilchbiz. For anyone else who is curious about the direction things are taking, make sure to read through this thread:

Hi guys,

Updated support for WPML in the new content builder. The “Edit {post type}” links now route you to the correct language of a post.

Does that mean that the content builder is now “fully” compatible with WPML? or are there still bugs to fix?

Thanks.

Yes, the content builder is fully compatible.

1 Like

It is maybe compatible with WPML, but still not with Polylang.
Rad had told me that once the permalink problem solved, it would also solve the problem with Polylang, but it doesn’t.

Worse, I had found a solution by changing all my pages URL from domain/en/page_name to domain/page_name which worked ok with previous version, but doesn’t anymore.

Now I have to disable Polylang each time I have to edit a page… !!!

Is anything planned about this? Any ETA? Should I do another post?

Updated with latest version Cornerstone 2.1.2 and Theme X 5.2.2 = Still NOT working

I’m sorry you’re having trouble here. We’ve not made any changes in regard to Polylang. We officially integrate with WPML, so that’s taken priority. I don’t have an ETA on when things will work with Polylang but we will investigate what’s possible from our end.

@alexander This is something that we talked about right when PRO was released, and you pointed us in the right direction for us to create a solution for it. It’s similar to #1, and it works by hooking into the Filter that you already have in place in the architecture (cs_match_header_assignment). Here is the code to review for anyone interested, in full plugin form,and can be copied and pasted should anyone want to use it.

This solution is so that we could have multilingual headers for the taxonomy pages, but this should work for any page. To make it more “user friendly” you could use WPMLs “get langauges” api functionality, create a drop down box in each header or footer, and assign an existing language. But, despite no WYSIWYG interface, the naming convention works quite well. Note that our solution allows for headers to be localized not just translated. This is huge in that different content, including layout, message, images, etc, can be served per language and not just translated content.

<?php

/*
  Plugin Name: Tourism Builder Custom Archive Pages
  Plugin URI:  http://tourismbuilder.com
  Description: Dynamically generated taxonomy pages
  Version:     1.0
  Author:      Blue Presley
  Author URI:  http://tourismbuilder.com
  Text Domain: tb_custom_archive_pages
  Domain Path: /languages
  License:     GPL-2.0+
 */

// https://codex.wordpress.org/Function_Reference/get_queried_object
function tb_category_header_assignment($match, $assignments, $post) {
    if (is_archive()) {

        $term = get_queried_object();
        //var_dump($term);
        // get posts of type cs_header

        $args = array(
            'posts_per_page' => -1,
            'offset' => 0,
            'orderby' => 'date',
            'order' => 'DESC',
            'post_type' => 'cs_header',
            'post_status' => 'tco-data' // <-- IMPORTANT - custom post status!!
        );
        $cs_headers = get_posts($args);
        //var_dump($cs_headers);
        // First check to see if there is an exact match for the header
        // If so, this allows for a header to be "localized" rather than
        // just translated; meaning, it's possible to deliver completely
        // different header content on a per language basis, including even images and layout.
        //
        // This is not for just multilingual capability. This funtionality
        // allows category pages to also have custom headers created via the
        // wysiwyg editor
        foreach ($cs_headers as $key => $header) {
            // print $header->post_title;
            if (strtolower($header->post_title) == strtolower($term->name)) {
                //print $term->name;
                $match = $header->ID;
                return $match;
            }
        }

        // If a match is NOT found, then check to see if a header already exists
        // in any language (most likely the source language). If so, use that
        // header. This eliminates the need to duplicate headers for each language
        // Also, this function should not fire if WPML is not enabled
        // get a list of all currently active languages
        // We're looking for the Key here since WPML returns the lang as the
        // key. 

        $langauges = apply_filters('wpml_active_languages', NULL);
        global $sitepress;
        
        foreach ($langauges as $key => $language) {
            // for each language check to see if a translation is available
            // if so, use it as the match and return
            // https://codex.wordpress.org/Function_Reference/get_category
            // watch out for gotcha: https://wpml.org/forums/topic/how-to-get-the-translated-taxonomy-object/




            $foreign_cat_id = apply_filters('wpml_object_id', $term->term_id, 'category', TRUE, $key);
            //echo "$foreign_cat_id, ";
            remove_filter('get_term', array($sitepress, 'get_term_adjust_id'), 1, 1);
            $category_object = get_category($foreign_cat_id);
            add_filter('get_term', array($sitepress, 'get_term_adjust_id'), 1, 1);
            //var_dump($category_object);

            foreach ($cs_headers as $key => $header) {
                //print $header->post_title;
                if (strtolower($header->post_title) == strtolower($category_object->name)) {
                    //print $category_object->name;
                    $match = $header->ID;
                    
                    return $match;
                }
            }
        }
        add_filter('get_term', array($sitepress, 'get_term_adjust_id'), 1, 1);
    }

    return $match;
}

add_filter('cs_match_header_assignment', 'tb_category_header_assignment', 10, 3);

With that said PLEASE code functionality into PRO architecture that allows assignment of headers to category pages!! :slight_smile :slight_smile:

Getting multilingual headers to work was pretty simple for simple applications. You can see it in action here with PRO http://dev.bluepresley.com/ozora/category/accommodations/

What has been a problem, and what ultimately has led us to have to advise clients to stick with X is the lack of translation support for the new WYSWYG interface. Also, in places where there were text boxes, these were not coded in a way that WPML could detect. (that may have changed though since this install is a few months old.) Hope this helps let me know if you have any questions. We’ve played with quite a few hacks to try to get ready to transition our clients from X to PRO.

I really appreciate you sharing this. We’ve been working on something similar (option #1 from here: https://theme.co/apex/forum/t/wpml-update-talk-to-us-about-translating-headers-footers/8756) and are hoping to make it available soon. I’ll take a look at what you’ve done with your code as it may help that official feature move a little faster.

I have 2 languages: english & german

I could just use the english header for now on the german page. Does this work?
Right now when switching to german I have no header or footer.

Hey, thank you for posting this. Since i’m not that much of a programmer I’m trying to find out how your solution works. I just pasted your code into my functions.php.

How do I go on now?

I basically just have a simple header with a menu which has to be german. For now I would also be satisfied if it would just show me the english header & footer when switching to german.