Answer the question
In order to leave comments, you need to log in
How to finalize the function of displaying the next month after the current one?
Hello!
There is a function to display the month 30 days from the current date:
function displaydate( $atts ) {
$atts = shortcode_atts( array(
'day' => '30'
), $atts );
$plus_days = $atts['day'];
return date_i18n('F', strtotime('+' . $plus_days . 'day'));
}
add_shortcode('show_date', 'displaydate');
Answer the question
In order to leave comments, you need to log in
To get the day:
date_i18n('d',strtotime('+1 month'));
Update
If you want to get the next month regardless of the current date:
date_i18n('F',strtotime('first day of +1 month'));
https://www.php.net/manual/ru/datetime.formats.rel...
instead strtotime('+' . $plus_days . 'day')
write strtotime('first day of next month')
and the result will be the 1st of the next month.
There is no need to add a fixed number of days (30) if the number is not important, but only the month is important.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question