This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by Dat Hoang 4 years, 3 months ago.

Assigned support staff: Dat Hoang.

Author Posts
April 8, 2015 at 10:01 pm #596118

jan-willemK

I am trying to: Update WPML to 3.1.9.4

I visited this URL: hidden link

I expected to see: The original homepage (www.lesliliving.nl) with the translated content.

Instead, I got: Probably some sort of falling back to the default page template that didn't happen before. I use the following functions to load template partials depending on the page/language being displayed:

<?php
function get_ID_by_slug($page_slug) {
    $page = get_page_by_path($page_slug);
    if ($page) {
    return $page->ID;
    } else {
    return null;
    }
}
function is_page_wpml($id,$slug) {
    if( icl_object_id($id, 'page', true, "nl") == icl_object_id(get_ID_by_slug($slug), 'page', true, "nl") ) {
        return true;
    } else {
        return false;
    }
}
?>
<?php if(is_page_wpml($post->ID,"home")) :?>
	<?php include("templates/home.php");?>

This worked totally fine but now it broke! Can I at the very least downgrade back to solve this?

April 8, 2015 at 10:52 pm #596134

jan-willemK

I tried resetting the permalink settings but this changed nothing. I tried the same functions I posted in the last message again on an old install I had with WPML 3.1.8.6 and it works no problem.

How can I solve this? I rather not downgrade if possible, but if I need to I'd love to know how to.

April 9, 2015 at 11:37 am #596481

jan-willemK

I read that version 3.1.9.2 changed something related to slugs in different languages.
Does this have anything to do with my situation maybe?

April 10, 2015 at 8:27 am #597079

Dat Hoang

The problem is about the filer in get_page_by_path() from WPML. We are discussing about this on our tracking bug system.

In short:
+ In the previous versions, get_page_by_path($slug) and WPML look for the page slug in all languages
+ In WPML 3.1.9.4, get_page_by_path($slug) and WPML look for the page slug in only the current language

So temporarily you should change your functions and specify the homepage ID. Or make sure all homepages (the original and its translations) have the same slug 'home'

Does that help?

June 3, 2015 at 8:23 am #631114

Dat Hoang

I'm closing this ticket.

This will be resolved in the next major version of WPML 3.2.

Please open the new tickets if you have any problem.