WordPress Site Update Widget

wordpress-3On one of my websites, I have older dated material, so it seems that the site is not being updated. I wanted to put a widget in place that would indicate that the “site was last updated” however; the native widget built into WordPress will not execute PHP code. I found a WordPress plugin called the Samsarin PHP Widget. The Samsarin PHP Widget adds a new text widget that allows PHP to be included inline.

I downloaded, activated, and added the widget to the sidebar.


I left the title blank and inserted the following code into the body.

This site was

// Change to the name of the file
$last_modified = filemtime("sitemap.xml");

// Display the results
// eg. last modified Monday, 27th October, 2003 @ 02:59pm
print "last modified " . date("F d, Y h:ia", $last_modified);


Wordpress sites are database driven, chances are that there are no files that are actually changed.  However with the installation of the plugin  Google (XML) Sitemaps Generator, the sitemap.xml file is generated and updated as posts are updated or added.

An example of this may be seen here.

Samsarin’s PHP Code Widget caused major problems after a recent upgrade of WordPress from version 2.5. I found a compatible Widget called Executable PHP Widget.