How to Show Newest Post without Plugins

Wordpress is support get newest article from database. But you only can show it by active Widgets.
This simple tutorial to show newest articles at anywhere you want.
Add this code to your template:
Custom css ul tag to accord your theme. Edit LIMIT 0,10 to show your newsest posts number.

<ul>
<?php
$recent_posts = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}posts WHERE post_type = 'post' AND post_status='publish' ORDER BY post_date DESC LIMIT 0,10");
foreach($recent_posts as $post) {
	print "<li><a href='". get_permalink($post->id) ."'>".$post->post_title."</a></li>\n";
}
?>
</ul>


Tags:   ·
digg delicious stumbleupon technorati Google live facebook Sphinn Mixx newsvine reddit yahoomyweb