Created
August 23, 2014 21:16
-
-
Save noahbass/f7ed91473bcf93bbb95f to your computer and use it in GitHub Desktop.
Site last updated function for wordpress
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 | |
/* | |
Description: Show the last time the website was updated. | |
Usage: use <?php site_last_updated(); ?> anywhere in your theme's files | |
*/ | |
function site_last_updated($d = '') { | |
$recent = new WP_Query("showposts=1&orderby=modified&post_status=publish"); | |
if ( $recent->have_posts() ) { | |
while ( $recent->have_posts() ) { | |
$recent->the_post(); | |
$last_update = get_the_modified_date($d); | |
} | |
echo $last_update; | |
} | |
else | |
echo ''; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment