Last active
March 11, 2023 10:08
-
-
Save gmmedia/2bd02fa2631d9510f3d8aefaf14ec9d0 to your computer and use it in GitHub Desktop.
Artikel und Seiten Aktualisierungsdatum
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 | |
// Änderungsdatum automatisch einfügen | |
function j0e_change_date($content) { | |
if ( (is_single() && get_post_type() == 'post') || is_page() ) { | |
$artikel_erstellt = get_the_date('U'); | |
$artikel_aktualisiert = get_post_modified_time('U'); | |
// Nur ausgeben, wenn Aktualisierung älter als einen Tag ist | |
if (($artikel_aktualisiert - $artikel_erstellt) > 86400) | |
{ | |
$content = 'Artikel aktualisiert am ' . get_the_modified_date('d.m.Y') . $content; | |
} | |
} | |
return $content; | |
} | |
add_filter('the_content', 'j0e_change_date'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment