Title: Modified Version Recently Updated Posts
Last modified: August 19, 2016

---

# Modified Version Recently Updated Posts

 *  Resolved [macmiller](https://wordpress.org/support/users/macmiller/)
 * (@macmiller)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/modified-version-recently-updated-posts/)
 * During the upgrade to 2.3.1 several plug-ins I was using stop working. One was
   Show Category Posts which I was using to display information on recent blog posts
   on my non-blog homepage.
 * See related posts:
    [topic 148851](http://wordpress.org/support/topic/148851?replies=2)
   [topic 148850](http://wordpress.org/support/topic/148850?replies=7) [topic 148761](http://wordpress.org/support/topic/148761?replies=4)
 * I found a working method to accomplish what I am trying to do and decided to 
   put up a separate thread to share it as opposed to putting in each of the above.
 * First off, there was a good suggestion to just do this:
 * `<?php wp_get_archives("type=postbypost&limit=20"); ?>`
 * Note: remember to put
 *     ```
       <?php
       /* Don't remove this line. */
       require('./blog/wp-blog-header.php');
       ?>
       ```
   
 * at the top of your non-blog page.
 * This will return a list of recent posts and works fine just by inserting this
   in your non-blog page. However, it returns only the post_title as a link. In 
   my case I wanted the post_title, post_date and post_excerpt to display.
 * The easiest way I found to get this information out is to modify a plug-in that
   works for 2.3.1. It is Recently Updated Posts. In it’s existing form it returns
   only a list of posts based on last mod date, I tweaked it to return the post,
   date, and excerpt and sort it on post date (as opposed to modified date).
 * Here is what I changed:
 * The foreach loop, changed to format date, and return date/excerpt:
 *     ```
       foreach($posts as $p) {
       		$title_ = str_replace('-', '- ', $p->post_title);
   
                       $tdYYYY = substr($p->post_date,0,4);
                       $tdMM = substr($p->post_date,5,2);
                       $tdDD = substr($p->post_date,8,2);
                       $ttHH = substr($p->post_date,11,2);
                       $ttMM = substr($p->post_date,14,2);
                       $ttSS = substr($p->post_date,17,2);
                       $tfmtdatetime = date('d-M-Y', mktime($ttHH, $ttMM, $ttSS, $tdMM, $tdDD, $tdYYYY));
       		print '<li>'.'<a href="'.get_permalink($p->ID).'" title="'.htmlentities($p->post_title).'">'.$title_.'</a>' . ' - ' . $tfmtdatetime . '</li>';
                       print '<li>' . '  ' . $p->post_excerpt . '</li>';
       	}
       ```
   
 * SQL select statement: I changed to select all the data fields (SELECT *) and 
   to sort by post_date_gmt.
 *     ```
       $sql = "SELECT * FROM'{$wpdb->posts}'"
       		. " WHERE 'post_status' = 'publish'"
       		. " AND 'post_modified_gmt' != '0000-00-00 00:00:00'"
       		. ($includePages
       			? " AND ('post_type' = 'post' OR <code>post_type</code> = 'page')"
       			: " AND 'post_type' = 'post'")
       		. ($hideProtectedPosts
       			? " AND 'post_password' = ''" : '')
       		. " AND 'post_modified_gmt' < '{$now}'"
       		. " ORDER BY 'post_date_gmt' DESC"
       		. " LIMIT {$skip}, {$no_posts}";
       ```
   
 * I found this plugin was quite small and easy to tweak.

Viewing 1 replies (of 1 total)

 *  [mojolocollc](https://wordpress.org/support/users/mojolocollc/)
 * (@mojolocollc)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/modified-version-recently-updated-posts/#post-671013)
 * does this display the title, date, and excerpt from a specific category? that’s
   what I’m trying to do, but haven’t had any luck finding a way to do it….**see
   my post here**[…](http://wordpress.org/support/topic/181741?replies=5#post-780373)

Viewing 1 replies (of 1 total)

The topic ‘Modified Version Recently Updated Posts’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [mojolocollc](https://wordpress.org/support/users/mojolocollc/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/modified-version-recently-updated-posts/#post-671013)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
