Last active
November 21, 2017 02:14
-
-
Save radarin/7a082c35e208639506daae870631e8da to your computer and use it in GitHub Desktop.
Wordpress: Erstellungs- und Änderungsdatum anzeigen
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 | |
// Erstellungsdatum Seite | |
function page_date() | |
{ | |
$page_erstellt = get_the_date('U'); | |
$page_aktualisiert = get_post_modified_time('U'); | |
$string_update = ''; | |
// Aktualisierung Seite, nur ausgeben, wenn Aktualisierung älter als einen Tag ist | |
if (($page_aktualisiert - $page_erstellt) > 86400) | |
{ | |
$string_update = ', <b>aktualisiert am </b>' . get_the_modified_date('d.m.Y'); | |
} | |
echo '<b>Seite erstellt am </b>' . get_the_date('d.m.Y') . $string_update; | |
} | |
// Erstellungsdatum Artikel | |
function article_date() | |
{ | |
$article_erstellt = get_the_date('U'); | |
$article_aktualisiert = get_post_modified_time('U'); | |
$string_update = ''; | |
// Aktualisierung Seite, nur ausgeben, wenn Aktualisierung älter als einen Tag ist | |
if (($article_aktualisiert - $article_erstellt) > 86400) | |
{ | |
$string_update = ', <b>aktualisiert am </b>' . get_the_modified_date('d.m.Y'); | |
} | |
echo '<b>Artikel erstellt am </b>' . get_the_date('d.m.Y') . $string_update; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment