Hi David.
If you have any experience in coding, then you can use the plugin editor to edit the code to achieve this. The code is always in the cs-integration/public/shortcodes/class-cs-XXX-view.php files. For example the Event Card view code is on line 84 of the class-cs-event-card-view.php file and the time on line 86 and 87.
I could add date/time format options to the short code. The problem would be sanitizing the input, but it’s doable. I’ll put it on my todo list, or you can raise a request on the GITHUB site.
I have created a block version of this plugin – see https://en-gb.wordpress.org/plugins/blocks-for-churchsuite/. It’s the same underlying code as this plugin, but exposes the attribute parameters in the block editor, and shows the results as you make changes. I haven’t got a date format or time format option in that yet either, but it is certainly possible.
Alwyn
Of course, I potentially could use something like:
$fmt = new IntlDateFormatter('de-DE', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
echo "DE: ".$fmt->format($d)."<br/>";
or to get a month name in a locale:
$fmt = new IntlDateFormatter('de-DE', IntlDateFormatter::NONE, IntlDateFormatter::NONE, NULL, NULL, "MMM");
$monthName = datefmt_format($fmt, mktime(0, 0, 0, $i));
… but I’m not sure how well this will work for each country – the format produced might still not be what’s wanted. Anyway, I’ll look into this.
-
This reply was modified 3 months, 2 weeks ago by
Alwyn Barry.
Hi Alwyn
I opend a PR on your GitHub repo where i added the date / time format as optional options in the shortcode. Let me know what you think.
Kind regards,
David
Just to say that I’ve updated the Blocks-For-ChurchSuite plugin so that it now uses the Locale to format all date and time output. I’ll move the changes back into this plugin as I have opportunity in the days ahead. Sorry for the prolonged delay in this – personal circumstances prevented the work.
Ok, the Locale sensitive code is in now, and so should work ‘automatically’ to get the Dates and Times rendered appropriate to location. However, it could still be dependent on the server – it uses ‘Default’ as the Locale setting, which is that of your server. If this doesn’t produce the required results, let me know and I’ll get it to pick up the Locale setting from the WordPress settings instead.
I’ve moved the Block Plugin to get the defaults set up for the WordPress Website (in the ‘General’ Settings) for locale and default time and date formats, and to render times and dates from those. This seems to work better – the server default wasn’t a useful way forward. I’ve also factored the time/date localisation code out into a single module to reduce code glut and improve maintainability. So I’ll move that code change into this shortcode soon so all can benefit.
Ok, since v1.0.8 the shortcodes are now set to output dates, day and month names, and times using the locale for a site as set in the WordPress settings page: Settings->General. It will also use any custom time or date output set on that page. So, date/time output will automatically follow that set for the WordPress site.