Interesting idea. Right now the format of the date is hard-coded in the plugin. I suspect there is probably some way to use the site’s date format instead of hard coding it.
I’m currently traveling (research on the next book I am writing, and visiting family), so will cogitate on this a bit and then work on it when I return home.
Thanks for the idea.
…Rick… (If you are interested in the fiction books I have written, go here .)
@blubbubb
I’d forgotten about this question while I was working on my latest fiction book.
But, the WP docs say that the post_date
value of the current post (which is used to display the date of the post) uses the system date format settings (in Administration, Settings, General).
So, does your date output (when using this plugin and the shortcode) follow the settings on that page?
Thanks….Rick…
Hi Rick,
sorry … a lot to do during the last months.
The date output doesn’t follow the settings on the page(s).
The output is “2019/12/16” on my site, I need the settings for the german timezone, e.g. ‘16.12.2019’ or in mysettings ’16. Dezember 2019′. Tried to change the formatting in the backend, nothing happens.
Thanks in advance and Merry Christmas,
Lars
Heh…I forgot about this also with all my other projects.
Can you changing this code around line #532:
if (!$atts['nodate']) {
echo '<span class="mpr_post_date">' . get_option('date_format'), $x->post_date . "</span>";
}
That takes the time setting in your site’s admin area and applies it to the output of the post_date in the Loop.
Let me know how it works for you. If OK, then I’ll do a quick update of the code.
Note that on my list of projects is an update of this plugin to combine the various display and posts of this and my similar plugins into one new plugin that will do posts, pictures, plus all the options. Not sure when I’ll have time for it, though.
Hi Rick,
unfortunately that doesn’t work .. I’m getting the output ‘d.m.Y2019-06-16 20:17:42 ‘ in the frontend.
Did some research, so I tried:
if (!$atts['nodate']) {
echo '<span class="mpr_post_date">' . date(get_option('date_format'), strtotime($x->post_date)) . "</span>";
}
This works better, the only problem for me is that the month name doesn’t get translated. But that’s not a big deal for me, instead of ’17.Dezember 2019′ it’s okay for me to display ‘17.12.2019’
Btw.: sounds good with your project, I’m very interested 🙂
According to the docs, that line (with your corrections) should get the date format as defined by the date/time format on the Settings, General page. Does that setting match the output of the shortcode on your system?
Yes it does, only the translation doesn’t work