Last active
February 8, 2022 15:57
-
-
Save nextab/88b8bf243db80d483aefd31ffb12922b to your computer and use it in GitHub Desktop.
Mit diesen beiden Code-Schnipseln lässt sich entweder das aktuelle Datum per PHP Code in WordPress ausgeben oder das Veröffentlichungsdatum eines Beitrags.
This file contains hidden or 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
| // Shortcode [releasedate] zeigt das AKTUELLE DATUM an. | |
| function release_date_shortcode($atts, $content = null) { | |
| $today = date_i18n('l, j. F Y'); | |
| return '<div class="date_container">Veröffentlicht am: ' . $today . '</div>'; | |
| } | |
| add_shortcode('releasedate', 'release_date_shortcode'); | |
| // falls du das VERÖFFENTLICHUNGSDATUM des Beitrags ausgeben möchtest, verwende stattdessen diesen Code: | |
| function release_date_shortcode($atts, $content = null) { | |
| $today = date_i18n('l, j. F Y'); | |
| return '<div class="date_container">Veröffentlicht am: ' . get_the_date('l, j. F Y') . '</div>'; | |
| } | |
| add_shortcode('releasedate', 'release_date_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment