I have designed a template for my website and I would like all of the WordPress and WooCommerce dates in the template to be converted from the Gregorian calendar to the Gregorian calendar.
I use the following shortcode to display the date my posts were published:
But the date it is showing is in Gregorian calendar and I want to change it to Shamsi.
I know there are many plugins to achieve this, but I want to add some code to my template so that my default template will always be a sun date.
I need any help using this feature.
Thank you very much.
Editor:
I have tried all these codes before but none of them changed the date in WordPress for me.
I am looking for a code that will convert all WordPress dates or at least display them by putting it in the functions.php
The date is in my solar template.
HijriCalendar.class.php
Persian Calendar
Edit 2:
I used moment.js library in the template and also used the javascript method but still it doesn't work.
How to change Gregorian date to Persian date in JavaScript?
Convert Gregorian date to Persian (Jalali) date in Angular 2 and Ionic 2
I think first you use get_the_time function to get the date and then convert it to shamsi date and echo it for display. Code like below works. You can add any other g2p functionality you want.