php - Wordpress shortcode to display post date +1 day
14
I'm trying to create a shortcode that will display the post date +1 day. Example: if the post was published on the 3rd I want a shortcode that will display 4th. I've tried the following but not getting the results I want.
// [nextday]
function displaydate_next(){
return the_time('jS', strtotime('+1 day'));
}
add_shortcode('nextday', 'displaydate_next');
// end nextday date
Answer
Solution:
I think you also need to get the month and year so it can calculate the next day. The below is what you need:
Answer
Solution:
You can use WP Date and Time Shortcode for the purpose. Just add
days="+1"
as an attribute.For example:
[wp-dt item="custom" format="jS" days="+1"]
.