Skip to content

Instantly share code, notes, and snippets.

@radarin
Last active November 21, 2017 02:14
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 radarin/7a082c35e208639506daae870631e8da to your computer and use it in GitHub Desktop.
Save radarin/7a082c35e208639506daae870631e8da to your computer and use it in GitHub Desktop.
Wordpress: Erstellungs- und Änderungsdatum anzeigen
<?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