Looking for a “Recently Updated” Wordpress Plugin

Michael Gray

By Michael Gray
In Tools  

Print Post Print Post Email Post Email Post    ADD TO STUMBLEUPON Sphinn It ADD TO DEL.ICIO.US  Tweet This

So after coming back from SES I had some interesting conversations, looked at some interesting things and came up with a few ideas. One of the things I’d like to try but have never seen is a recently updated function/plugin. How would a recently updated plugin differ from a recently published function … well I’m glad you asked …

Recently updated would be used when you are using pages or posts in a more traditional CMS environment instead of a blog one. For example say you have a library or article database of keystone or flagship content. After the site is 3-4 years old the content may be come outdated. Rather than put up a new page/post with a new URL you decide to use the existing one and update or refresh the content. It would be nice if you could have a list of the ten most recently updated articles or even a page of the 50 or 100 most recently updated pages/posts. Sure you could hack the functionality by changing the publish date but that introduces other complexities.

UPDATE
Thanks to Corey Salzano who cooked up some quick code, thanks.


< ?php
$today = current_time('mysql', 1);
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT 18")):
?>
<h2>< ?php _e("Recent Posts"); ?></h2>
<ul>
<?php
foreach ($recentposts as $post) {
if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "<li><a href='".get_permalink($post->ID)."'>";
the_title();
echo '</a></li>';
}
?>
</ul>
< ?php endif; ?>

Related posts:

  1. Wordpress SEO: How to Create Living URL’s If you watched any of the congressional hearings about the...
  2. Category SEO For Wordpress Blogs and Ecommerce I solved (at least partly) my problem maintaining rankings over...
  3. Wordpress SEO: How to Choose a Permalink Structure For this post we’re going to be taking  look at...

Crazyegg Link Tracking

{ 1 trackback }

Customize your WordPress Theme | Neowster
October 10, 2008 at 11:02 am

{ 8 comments }

CS August 29, 2008 at 9:52 am

I am using a theme Grayland 1.0 that has this functionality built into the bottom of the template by default. The developer’s site is dandyland dot org. I wonder if all this PHP will paste nicely?

get_results(”SELECT ID, post_title FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_date_gmt

post_title == ”)

$post->post_title = sprintf(__(’Post #%s’), $post->ID);

echo “ID).”‘>”;

the_title();

echo ‘‘;

}

?>

CS August 29, 2008 at 9:55 am

Nope!

Nat Arem August 29, 2008 at 11:36 am

It seems like it would be easy to hack your way to this sort of functionality in a theme. Using the wpdb class would make it easily to access any sort of info that you might need. The “posts_modified_gmt” field in the posts table would be the one you’d want to go after, not the “post_date_gmt” field being used above. I would use the query below:

SELECT *
FROM $wpdb->posts
WHERE `post_status` = “publish” AND `post_type` = “page”
ORDER BY `post_modified_gmt` DESC

Then you’d just need to print out like ten rows worth somewhere on your page or whatever.

On the other hand, doing it in a plugin is a little more complicated, although not overly difficult.

Bryan August 29, 2008 at 3:57 pm

Thanks Michael and Corey for getting this in place. This plugin is a perfect fit for an instructional site I’m making with WordPress.

eko agus September 1, 2008 at 4:12 am

tx’s for the information that’s plug in to help full improve my WP

David Wilson September 10, 2008 at 9:38 pm

Michael

Under the Publish Status section there is the option to change the post to a different date than it was originally created. Would this not do the same thing as the code above?

David

Michael Gray September 10, 2008 at 10:57 pm

@David Wilson: yes but the goal is to not throw the page back into the RSS of new posts

Nat Arem September 10, 2008 at 11:54 pm

Well, the RSS thing is one aspect, but there’s also the manual work aspect of that solution. Not to mention that there’s no point because WP automatically keeps a field for the latest update already.

Comments on this entry are closed.