WordPress.org

Ready to get started?Download WordPress

Forums

Flexible Posts Widget
Working with WPML? (9 posts)

  1. Hung Pham
    Member
    Posted 1 year ago #

    I am building a new site with FPW and WPML. The plugin can show all categories in all languages just fine. But when I choose a category in English, the chosen one in Vietnamese is automatically unchecked.

    Is it because this plugin is not working well with multiple languages or not working well with WPML?

    Thanks.

    http://wordpress.org/extend/plugins/flexible-posts-widget/

  2. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  3. Hung Pham
    Member
    Posted 1 year ago #

    Just followed you on Twitter :)

    Thanks.

  4. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  5. Dehumanizer77
    Member
    Posted 1 year ago #

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

  6. DaveE
    Member
    Plugin Author

    Posted 10 months ago #

    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!

  7. _Aquarius_
    Member
    Posted 6 months ago #

    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;
    }
  8. DaveE
    Member
    Plugin Author

    Posted 6 months ago #

    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!

  9. _Aquarius_
    Member
    Posted 6 months ago #

    Hi Dave,

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

    See you soon ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags