Created
March 1, 2022 10:10
-
-
Save thierrypigot/730219dd47554fcb37ba659102568193 to your computer and use it in GitHub Desktop.
Date shortcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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