• Hi Devs,

    I wish if you can officially add WPML support. I personally could get the plugin working with WPML by adding this to slider_versions/j.php :

    if(defined('ICL_LANGUAGE_CODE') && function_exists('icl_object_id'))
    	$id = icl_object_id($id, get_post_type($id), true);

    right after line#42 :

    ...
    41	foreach($posts as $post) {
    42		$id = $post->post_id;
    43		// add support for WPML
    44		if(defined('ICL_LANGUAGE_CODE') && function_exists('icl_object_id'))
    45			$id = icl_object_id($id, get_post_type($id), true);
    46		$posts_table = $table_prefix.'posts';
    47		$sql_post = "SELECT * FROM $posts_table WHERE ID = $id";
    48		$rs_post = $wpdb->get_results("SELECT * FROM $posts_table WHERE ID = $id", OBJECT);
    49		$data = $rs_post[0];
    ...

    But I think you also need to change that in some other places, for other features I am not using, like getting feature posts from a specific category.

    Basically, all what you need to add support for WPML, is to pass every post ID, that is going to be shown on the slider, to WPML’s icl_object_id() function, which then returns the post ID of the translation in the current active language. So similar two lines.

    icl_object_id() function is documented here.

    Although I could easily change the file adding support for WPML, that would make the upgrading harder for me in the future, so I really hope you add it officially. It’s easy, and I’m sure a lot of people will need it.

    Thanks!

    https://www.ads-software.com/extend/plugins/smooth-slider/

  • The topic ‘[Plugin: Smooth Slider] WPML compatibility could be easily added’ is closed to new replies.