Pastebin launched a little side project called HostCabi.net, check it out ;-)Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!

Display Recently Updated Posts for category

By: Streamingdb-net on Apr 7th, 2011  |  syntax: PHP  |  size: 0.93 KB  |  hits: 273  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <div class="statistics">
  2. <?php
  3. $today = current_time('mysql', 1);
  4. if ($recentposts = $wpdb->get_results("SELECT ID, post_title, post_modified FROM $wpdb->posts    WHERE post_status = 'publish' AND post_type = 'post' AND post_name NOT LIKE  '%revision%' AND post_name NOT LIKE '%autosave%' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt")) :
  5. ?>
  6. <h2><?php _e('ULTIME REVISIONI'); ?></h2>        
  7. <ul>
  8. <?php $args = array('category' => '', 'orderby'  => 'modified', 'post_status' => 'publish', 'posts_per_page' => 11);
  9. $recent_posts = wp_get_recent_posts($args);
  10. foreach ($recent_posts as $post) {
  11. if ($post["post_title"] == ''){ $post["post_title"] = sprintf(__('Post #%s'), $post["ID"]);
  12. }
  13. ?>
  14. <li><a href='<?php echo get_permalink($post["ID"]) ?>'>
  15. <?php echo mysql2date('d/m/Y', $post["post_modified"]) ?>
  16. &nbsp;-&nbsp;
  17. <?php echo $post["post_title"] ?>
  18. </a></li> <?php } ?>
  19. </ul>
  20. </div>
  21. <?php endif; ?>