Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Created March 1, 2022 10:10
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 thierrypigot/730219dd47554fcb37ba659102568193 to your computer and use it in GitHub Desktop.
Save thierrypigot/730219dd47554fcb37ba659102568193 to your computer and use it in GitHub Desktop.
Date shortcode
<?php
// [jour] => mardi
add_shortcode( 'jour', 'waw_shortcode_jour' );
function waw_shortcode_jour() {
return date_i18n('l');
}
// [mois] => mars
add_shortcode( 'mois', 'waw_shortcode_mois' );
function waw_shortcode_mois() {
return date_i18n('F');
}
// [annee] => 2022
add_shortcode( 'annee', 'waw_shortcode_annee' );
function waw_shortcode_annee() {
return date('Y');
}
// [today] => mardi 1 mars 2022
add_shortcode( 'today', 'waw_shortcode_today' );
function waw_shortcode_today() {
return date_i18n('l j F Y');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment