WP Date and Time Shortcode – WordPress plugin Free download

WP Date and Time Shortcode

Description

Use this plugin if you want to display a current, past or future date or time that may or may not change during every new visit of the specific page or post.

It takes lots of efforts to develop and support a plugin for free. Please send us your feedback and questions to fix your issue before leaving a bad review.

WARNING: If you are using a caching plugin you may need to exclude the page or post from it so the content may be generated dynamically with every single visit.

The shortcode tag can be used as both [wp-dt] or [wp_dt] at your choice. The attributes for the shortcode are:

‘item’ – what date and time information to show. The used values are:

‘datetime’ – default WP date and time format (default value)
‘date’ – default WP date format
‘time’ – default WP date format
‘custom’ – custom format used by the built-in PHP date() function
‘year’ – 4-digits year
‘year-short’ – 2-digits year
‘month’ – month as number (1-12)
‘month-name’ – month as name (January-December)
‘month-name-short’ – month as three letters name (Jan-Dec),
‘day’ – day of month
‘hours’ – hours
‘minutes’ – minutes
‘seconds’ – seconds
‘day-of-year’ – day of the year as number
‘days-in-month’ – number of days in the month
‘days-in-february’ – number of days in the month of February for the year
‘weekday’ – day of the week as number (1-7)
‘weekday-name’ – day of the week as full name (Monday-Sunday)
‘weekday-name-short’ – day of the week as full name (Mon-Sun)
‘am_pm’ – shows am/pm or AM/PM according to the am_pm attribute (L or U)
‘timezone’ – show the timezone
‘timezone-abbreviation’ – show the timezone abbreviation

‘format’ – format that can be used the PHP date() function, used only when ‘item’ is set to ‘custom’
‘init’ – initial date and time string in mysql format
‘i18n’ – set months and weeks names to be displayed in the current language
‘months_zero’ – set leading zero for months
‘days_zero’ – set leading zero for days
‘days_suffix’ – set suffix st, nd, rd, th for days
‘hours_zero’ – set leading zero for hours
‘hours_24’ – set 24 or 12 hours format
‘minutes_zero’ – set leading zeros for minutes
‘seconds_zero’ – set leading zeros for seconds
‘am_pm’ – used when 12 hours format is preferred: ‘L’ for lowercase (am, pm) or ‘U’ for uppercase (AM, PM)
‘years_change’ – change in years
‘months_change’ – change in months
‘days_change’ – change in days
‘hours_change’ – change in hours
‘minutes_change’ – change in minutes
‘seconds_change’ – change in seconds

Here are some samples of the shortcode with a variety of attributes and the results:

Show current date and time in default WordPress format:
[wp-dt] => 16/09/2019 17:45

Show current date only in the default WordPress format:
[wp-dt item=”date”] => 16/09/2019

Show current time only in the default WordPress format:
[wp-dt item=”time”] => 17:45

Show current date and time with custom format:
[wp-dt format=”d F Y H:i A”] => 16 September 2019 17:45 PM

Show the time 3 years, 4 months, 5 days, 6 hours, 20 minutes and 30 seconds ago starting from a specific date:
[wp-dt init=”2019-09-16 17:45:53″ format=”M j, Y H:i:s a” years_change=”-3″ months_change=”-4″ days_change=”-5″ hours_change=”-6″ minutes_change=”-20″ seconds_change=”-30″] => May 11, 2016 11:25:23 am

Show 4 and 2-digit year, month and day of month:
[wp-dt item=”year”], [wp-dt item=”year-short” years_change=”+2″], [wp-dt item=”month” months_change=”+1″], [wp-dt item=”day” days_change=”-1″ days_zero=”no”], [wp-dt item=”day” days_zero=”no” days_suffix=”yes”] => 2019, 21, 10, 15, 16th

Show month name (previous, this and next month):
[wp-dt item=”month-name” months_change=”-1″], [wp-dt item=”month-name”], [wp-dt item=”month-name” months_change=”+1″] => August, September, October

Show month short three letter name (previous, this and next month):
[wp-dt item=”month-name-short” months_change=”-1″], [wp-dt item=”month-name-short”], [wp-dt item=”month-name-short” months_change=”+1″] => Aug, Sep, Oct

Show week of the year, day of the year, days in the month, days in February for the year:
[wp-dt item=”week-of-year”], [wp-dt item=”day-of-year”], [wp-dt item=”days-in-month”], [wp-dt item=”days-in-february”] => 38, 259, 30, 28

Show weekday as number, full name or three letter name:
[wp-dt item=”weekday”], [wp-dt item=”weekday-name”], [wp-dt item=”weekday-name-short”] => 1, Monday, Mon

Show hours, minutes, seconds and am/pm:
[wp-dt item=”hours” hours_24=”no” hours_zero=”no”]:[wp-dt item=”minutes”]:[wp-dt item=”seconds”] [wp-dt item=”am_pm”] => 5:45:53 pm
The same may be achieved with the built-in PHP date and time string formatting:
[wp-dt format=”g:i:s a”] => 5:45:53 pm

Show a timezone and timezone abbreviation:
[wp-dt item=”timezone”], [wp-dt item=”timezone-abbreviation”] => Europe/Sofia, ?

Learn more at the page of WP Date and Time Shortcode or contact us by e-mail for more information.

Features

Show date and time in the default WordPress or customer format.
Show separately date and time
Show separately 4 or 2-digit year
Show month as number, full name (e.g January) or three letters (e.g. Jan)
Show day as number with or without leading zero, with or without suffix (st, nd, rd, th)
Show hour, minutes, seconds with or without leading zero
Show day of week as number, full name (e.g. Monday) or three letters (e.g. Mon)
Show the week of the year
Show the day of the year
Show the number of days for the month
Show the number of days in February for the year
Show timezone and timezone abbreviation
Show any combinations for date and time using the built-in PHP date() function format
Add or subtract years, months, days, hours, minutes and/or seconds before showing the final result.

Installation

From WordPress Dashboard

Navigate to ‘Plugins -> Add New’ from your WordPress dashboard.
Search for ‘WP Date and Time Shortcode’ and install it.
Activate the plugin from the Plugins menu.

Manual Installation

the plugin file: ‘wp-date-and-time-shortcode.zip’
Unzip the file
Upload the ‘wp-date-and-time-shortcode.zip’ folder to your ‘/wp-content/plugins’ directory (do not rename the folder).
Activate the plugin from the Plugins menu.

It will start doing it’s job as soon as you put the shortcode in your page ot post. That’s all, folks!

FAQ

Can I use both [wp-dt] and [wp_dt] interchangeably?

Yes, you can. We have added both shortcode names because some people like underscores and others – hyphens, and it might lead to errors.

I have an idea how this plugin can be improved. Can I send it somehow?

Yes, please send all your suggestions and ideas to our e-mail address.

Leave a Reply

Your email address will not be published.