This weblog was moved from MoveableType to Wordpress just a few days ago and we’ve already created our first hack.
The hack sits in the my-hacks.php file and implements a function to return a list of the {n} most recently posted items. Here it is:
function get_recent_posts($limit = 10) {
global $wpdb, $tableposts;
$list = \"<ul>n\";
$rows = $wpdb->get_results(\"
SELECT ID, post_title, post_date,
post_name FROM $tableposts
WHERE post_status = 'publish'
ORDER BY post_date DESC
LIMIT 1, \".$limit);
foreach($rows as $row){
$list .= \"<li><a href=\"\".get_permalink($row->ID) .
\"\">\" . $row->post_title . \"</a></li>n\";
}
$list .= \"</ul>n\";
echo($list);
}
Feel free to use it yourselves.







