EDIT: I’ve managed to show the correct date format using the shortcode:
[lifterlms_course_info id=”1456″ key=”enrollment_start_date” type=”date” date_format=”d/m/Y”].
Ï have used type=”date and date_format=”d/m/Y”
But is there a way to force LifterLMS to use the same date/time format as the WordPress settings?
Hi @himidia,
I’m glad you are able to find a manual workaround. However, you mentioned that you want to force LifterLMS to use WordPress date/time settings. In this case, we recommend that you try using the llms_shortcode_course_info filter for that shortcode. That filter is defined in wp-content/plugins/lifterlms/includes/shortcodes/class.llms.shortcodes.php.
Thanks @reddotinmotion ! I will look for this.
So if a make copy of ths file (wp-content/plugins/lifterlms/includes/shortcodes/class.llms.shortcodes.php), put it at my child-theme I can safely edit the date format the way I want, right?
Thank you!!
Hi @himidia ,
You can indeed copy the class.llms.shortcodes.php file and place it in your child theme to make modifications, such as adjusting the date format. However, please note that simply placing the file in your child theme won’t override the plugin’s behavior automatically, WordPress doesn’t load PHP class files from child themes by default.
Also, modifying core plugin files, even in a copied version, can lead to compatibility issues down the line. While placing custom code in a child theme ensures your changes aren’t lost during theme updates, future LifterLMS plugin updates could change how the original file functions, requiring you to revisit your custom code for continued compatibility. For long-term maintainability, using available hooks or filters to customize output whenever possible.
Also, I would like to mention that we are considering an update that would make the date formatting respect your WordPress General Settings, for example, setting the format to d/m/Y in your site settings would reflect that format across your courses. While we don’t have an exact release date yet, this enhancement is on our radar.
All the best,
Hi @himidia ,
If you update to the latest version of LifterLMS (8.0.3), the default format of these dates should match your site format.
Any issues with it let us know!
hi @brianhogg, I am running version 8.0.3 already!
Hi @himidia,
I tried using [lifterlms_course_info key="enrollment_start_date"] inside a course page when using LifterLMS 8.0.3, and it obeyed the date settings in WordPress Dashboard > Settings > Date Format. When I used LifterLMS 8.0.2, the date settings were not obeyed. Could you confirm this on your end?
Hi @reddotinmotion,
Thanks, I’ve tested the shortcode without type=”date” date_format=”d/m/Y” and now it worked!
Now it is following the same setting as WordPress settings.
Thanks so much!