I want to display a in Hindi like "jan 10" using get_the_date(). What i have tried :
<?php echo get_the_date(_e('F j')); ?>
output like : F jJanuary 10, 2017.
Try below code.
echo get_the_date(__('M d'));
echo get_the_date(__('M d, Y'));
Feb 09, 2017
Old question, but no answer accepted, so here goes..
You get weird output, because
_e just prints "F j" literally and isn't passing it to the function. Hence you get the raw format followed by the default date format.
However, you don't need to use any translation function, because get_the_date() handles it all. Just do:
<?php echo get_the_date('F j'); ?>
Translations of the months are in the WordPress core translation files. If you have a translation of "October" in Hindi and have your site language set to
hi_IN it will display the translated date.
See this recent, similar question with some more detail on the date_format option.