WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Working with WPML?

[Resolved] Working with WPML?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author DaveE

    @dpe415

    Hi Hung,

    I haven’t worked with WPML in the past, so I can say what the issue might be. Could you get me login credentials for the website you’re working on and I can take a closer look at the issue? The best way to get me login credentials is by sending me a message on Twitter: https://twitter.com/dpellenwood. Follow me, I’ll follow you back and then you can send me a message with the info.

    Thanks!

    Just followed you on Twitter 🙂

    Thanks.

    Plugin Author DaveE

    @dpe415

    Hi Hung,

    I haven’t had a chance to dig into this. I’m sorry, but I’ve been really busy with work and FPW is a free plugin that I provide to users without any warranty.

    Debugging the compatibility issues with WPML isn’t something that I can easily tackle since it will require actually setting up WPML, learning how it works and then debugging what may or may not be causing issues.

    For clarification, are you trying to check categories from several languages (English & Vietnamese) in the same widget? I’m not sure if that will be possible since WPML only gives access to the selected language’s categories when using that language. To FPW, English categories don’t exist when you’ve selected Vietnamese or vice-versa.

    I’ll keep this ticket open and down the road I’ll try to take a look at it again, but for now, I just can’t give it the amount of time needed to thoroughly investigate. Sorry!

    I have the same problem and would very much appreciate if you could take a look into that.

    Plugin Author DaveE

    @dpe415

    Hi all,

    I had a chance to dig into this a bit, but I’m not sure of how to resolve it. Basically, it looks like WPML actually sets up a different set of categories for each language, so trying to use it with both sets of categories is virtually impossible (since WPML only allows “access” to one language’s categories at a time).

    However, I may be misunderstanding the situation some. I had thought the WPML people were going to help with a resolution, but I’ve never heard back from them. So, for now, I have to let this request stay as it is. Sorry!

    It’s not e definive solutions but it can do the job, in your functions.php

    Remember to update the widgets only in your primary language.

    add_filter( 'dpe_fpw_args', 'fpwWpmlFix' );
    
    function fpwWpmlFix ( $args )
    {
    	// if WPML exists
    	if( class_exists( 'SitePress' ))
    	{
    		if( function_exists( 'icl_get_languages' ))
    		{
    			global $sitepress;
    			$defLang = $sitepress->get_default_language();
    
    			if( ICL_LANGUAGE_CODE != $defLang )
    			{
    				$catID = get_category_by_slug( $args["tax_query"][0]["terms"][0] );
    
    				$wpmlCatID = icl_object_id( $catID->term_id,'category', true );
    				$wpmlCatSlug = get_category( intval( $wpmlCatID ));
    
    				// Setup the tax & term query based on the user's selection
    				if( $args["tax_query"][0]["taxonomy"] != 'none' && !empty( $args["tax_query"][0]["terms"][0] ))
    				{
    					$args["tax_query"][0]["terms"][0] = $wpmlCatSlug->slug;
    				}
    			}
    		}
    	}
    
    	return $args;
    }
    Plugin Author DaveE

    @dpe415

    Hi Aquarius, thanks for doing the leg work here!

    For others who may want to apply this fix for WPML, it looks like this will work as long as there is only one category or term selected for the taxonomy. This will most likely work for 90% of users, but I’ll take a look at extending it further and integrating it into the plugin as soon as get a chance.

    Thanks again!

    Hi Dave,

    I just forgot about multiple category or term 😛 Hope in your integration: I like your plugin and I really wanna use it.

    See you soon 😉

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Working with WPML?’ is closed to new replies.