Skip to content

Instantly share code, notes, and snippets.

@wpgaurav
Last active September 16, 2022 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpgaurav/fe9b9a11e784ca50f988666488de8635 to your computer and use it in GitHub Desktop.
Save wpgaurav/fe9b9a11e784ca50f988666488de8635 to your computer and use it in GitHub Desktop.
New shortcode [seomonth] that renders next month from 21st of this month
<?php
// you can change 20 on line #8 to any date between 1 to 27
add_shortcode( 'seomonth' , 'gtrmd_seomonthyear' );
function gtrmd_seomonthyear() {
$gtseomonthyear1 = date_i18n("F");
$gtseomonthyear2 = date("F", strtotime ( '+1 month' , strtotime ( $gtseomonthyear1 ) )) ;
$gtdtseocheck = date("j");
if($gtdtseocheck > 20){
return "$gtseomonthyear2";
} else{
return "$gtseomonthyear1";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment