Tag: wpml_get_language_information

  • How to make Popularity Posts Widget compatible with WPML

    How to make Popularity Posts Widget compatible with WPML

    In table $prefix_PopularityPostsWidget  The view record store here like this: There is WPML function wpml_get_language_information can get the post language information by post id, like this wpml_get_language_information($post->ID)   Array ( [locale] => fr_FR [text_direction] => [display_name] => Français [native_name] => Français [different_language] => ) Array ( [locale] => en_US [text_direction] => [display_name] => Anglais [native_name] => English [different_language] => 1 ) If it’s different language, the value will be true (1) Depand on this, now we can modify public function widget in class_popularity-posts-widget.php Inside function widget, find loop foreach ($rows as $row) Replace by the code between: ////////////// Loop /////////////////// foreach ($rows as $row) { } ////////////// End of loop…