Skip to content

Instantly share code, notes, and snippets.

@Perun
Last active May 29, 2017 23:21
Show Gist options
  • Select an option

  • Save Perun/5861746 to your computer and use it in GitHub Desktop.

Select an option

Save Perun/5861746 to your computer and use it in GitHub Desktop.
Es wird erkannt wenn ein Artikel aktualisiert wurde (1. Datei) und die Aktualisierungszeit wird dann im Frontend ausgegeben (2. Datei). Siehe auch http://www.perun.net/2013/03/19/wordpress-habt-keine-angst-vor-dem-artikel-datum/.
<?php
function aktualisierung()
{
$artikel_erstellt = get_the_date('U');
$artikel_aktualisiert = get_post_modified_time('U');
// Nur Aktualisierungen die älter als 12h sind werden berücksichtigt
if (($artikel_aktualisiert - $artikel_erstellt ) > 43200)
{
echo ' &ndash; Aktualisiert am ' . get_the_modified_date('d.m.Y') . ' um ' . get_post_modified_time('H:i');
}
}
?>
<?php echo aktualisierung(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment