Skip to content

Instantly share code, notes, and snippets.

@noahbass
Created August 23, 2014 21:16
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 noahbass/f7ed91473bcf93bbb95f to your computer and use it in GitHub Desktop.
Save noahbass/f7ed91473bcf93bbb95f to your computer and use it in GitHub Desktop.
Site last updated function for wordpress
<?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