Widget title WPML compatibility
-
I’m using version 4.8:
Please, make widget title translatable through WPML.
The title must be filtered by ‘widget_title’ filter.
In the ‘recent-posts-widget-with-thumbnails.php’ file, line 109, you have this code:$title = ( ! empty( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : '';it must be changed for this code (obtained from wpml.org: https://wpml.org/documentation/getting-started-guide/translating-widgets/)
$title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );This do the trick, and now the title is translatable by WPML.
This is very important for multilingual web sites!
THX!https://ww.wp.xz.cn/plugins/recent-posts-widget-with-thumbnails/
-
Thank you very much for this notice. I will take a look and reply soon.
You are welcome! I really like this plugin. Congratulations.
Please look at the next line containing
apply_filters( 'rpwwt_widget_title', $title, $instance, $this->id_base )In the past there the hook name was ‘widget_title’.
To avoid undesired interferences I changed the hook to ‘rpwwt_widget_title’. Too bad that that avoid desired interferences, too.
I hoped developers would add a line containing
add_filter( 'rpwwt_widget_title', ... )
calling the same function as ‘widget_title’.I am thinking about what the best choice would be: to keep that hook name or to rename it back to ‘widget_title’?
Would you please do me a favour and change the hook name to ‘widget_title’ to test the effect with WPML?
Yes 🙂
Renaming back your custom filter ‘rpwwt_widget_title’ to ‘widget_title’ the translation works ok.This are the lines 109 and 110 now:
$title = ( ! empty( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : '';
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
Is working ok for me.
Thank you! In the next upgrade the hook will be renamed back to ‘widget_title’. I am busy now so the upgrade will be in future.
With the new version 4.9 the hook name is permanently changed back from ‘rpwwt_widget_title’ to ‘widget_title’ to let 3rd-party applications take effect on it.
If you like this plugin I would be glad about your review.
The topic ‘Widget title WPML compatibility’ is closed to new replies.