Modern Tribe’s Events Calendar and loop-grid modification

Modern Tribe offers an interesting plugin called Events Calendar (WordPress).

Although it is mainly hassle-free, some problems may occur when integrating the plugin to a multilingual website (or in conjunction with the Polylang or qTranslate plugins).

Hence, working on a website creation project for a French-language kindergarten, I realized that when the calendar page was consulted for the first time, the days appeared in English at the top of the calendar grid, even though the WordPress site was in French and Polylang was activated as French by default. When the user consulted the previous or next month, everything would then appear in French, as required.

So, here’s one way to avoid such a bug: by removing the day row from the grid loop.

You need to edit this file: wp-content/plugins/the-events-calendar/views/month/loop-grid.php (through FTP or in your cPanel)…

Then, replace this line:

<th id=”tribe-events-<?php echo strtolower( $day ) ?>” title=”<?php echo $day ?>” data-day-abbr=”<?php echo $wp_locale->get_weekday_abbrev( $day ); ?>”><?php echo $day ?></th>

by the following line:

<th id=”tribe-events-<?php echo strtolower( $day ) ?>” title=”<?php echo substr($day, 0, 0); ?>” data-day-abbr=”<?php echo $wp_locale->get_weekday_abbrev( $day ); ?>”><?php echo $day ?></th>

If you would prefer to abbreviate the days in the grid (i.e.: Wed instead of Wednesday), you can do so by replacing $day, 0, 0 by $day, 0, 3. 

The last digit, 3, means three letters; if you would prefer a single letter for the day, then you would modify it to $day, 0,1.

Best regards.



Advertisements

Comments / Commentaires