Event title translation in widget calendar
-
Hi,
I’m using WPGlobus plugin for translation and the event titles didn’t show correctly on mouse hover over the dates in the EO widget calendar. Instead of showing either the russian version or the french version of an event’s title, it showed {:ru}russian_title{:}{:fr}french_title{:}. You can see this here on the event scheduled on March 18th.
I managed to fix this by editing the code in class-eo-calendar-widget.php and replacing this (lines 348-353) :foreach ( $events as $event ) { $class = array_merge( $class, eo_get_event_classes( $event->ID, $event->occurrence_id ) ); } $class = array_unique( array_filter( $class ) ); $classes = implode( ' ', $class ); $titles = implode( ', ', wp_list_pluck( $events, 'post_title' ) );
with this :
$titles_array = array(); foreach ( $events as $event ) { $class = array_merge( $class, eo_get_event_classes( $event->ID, $event->occurrence_id ) ); $titles_array[] = get_the_title( $event ); } $class = array_unique( array_filter( $class ) ); $classes = implode( ' ', $class ); $titles = implode( '& #13;& #10;', $titles_array );
It works fine, but any plugin update will remove my changes. Is it possible to include this fix in the next EO update?
Note: In the last line of my code, I’m changing the original comma into a new line. That part isn’t really a bug fix, but I thought it looks better if each event is on a separate line. “& #13;& #10;” is replaced by a new line if written without the spaces, here on the forum, even when enclosed in backsticks, so I added spaces that need to be removed in the actual code.
- The topic ‘Event title translation in widget calendar’ is closed to new replies.