i agree with @vtxyzzy
additionally,
the current date would be something like:
<?php echo date('j F Y'); ?>
http://php.net/manual/en/function.date.php
you code would show the publish date of probably the last post in the main content (unpredictably depending on the location of your textwidget)
or alternatively use some javascript in the textwidget; for instance (http://www.mediacollege.com/internet/javascript/date-time/):
<script type="text/javascript"><!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
document.write(day + "/" + month + "/" + year);
//--></script>
Thread Starter
Karl
(@yitschak)
Thanks so much guys this is a big help… Another question: How can I place the current date on any part of site for example placing it on paragraph on post/page area. any idea?
Your responses is greatly appreciated.
I would create a shortcode function that would return the date. That shortcode could be used in the content of a post or page, but to use it in a text widget, you will have to add the do_shortcode filter to the widget_text hook:
add_filter('widget_text','do_shortcode');
Thread Starter
Karl
(@yitschak)
thank you vtxyzzy. it’s a big help.