How can you add a "display current date" capability to a WordPress theme?

Best Answer
0
0

The solution I outlined in my first answer works, but the date displayed does not align with my time zone set in WordPress.  After a certain time in the evening, it displays the next day’s date.

Now, I use the WP Date and Time Shortcode plugin.  I’ve used it for a couple of weeks now, and  it displays the correct date all the time.

You can see an example by visiting the netpressions net directory on this site at the url below

https://netpressions.com/net/

The plugin can. be found at the url below:

https://wordpress.org/plugins/wp-date-and-time-shortcode/

 

  • You must to post comments
0
0

I needed to add a display current date capability to the Avada theme, and adding the code below to the Avada Child Theme’s functions.php worked for me

function displayTodaysDate( $atts )
 
{
 
return date(get_option('date_format'));
 
}
 
add_shortcode( 'datetoday', 'displayTodaysDate');

To display the date in your theme, use the shortcode [datetoday] where you would like the date to display. In my case, I wanted to display it in the top bar in the header.

I obtained this ssolution from the url below

https://www.elegantthemes.com/blog/tips-tricks/3-different-ways-to-automatically-show-todays-date-in-wordpress

  • You must to post comments
Showing 2 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website