groups

name language licence
Display Gravatars (WordPress 2.5+ Only) PHP BSD
404 PHP GPL 2
Untitled Snippet Other Other
Adding a Mini-Loop PHP Other
Untitled Snippet PHP Other
translations of CSS3 selectors for SocialMe PHP Other
last.fm PHP BSD
profile 4 Other Other

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 >



language: PHP
licence: Other

Adding a Mini-Loop

options: view full snippetsend to code collector
<?php
$how_many=5; //How many posts do you want to show
require_once('wp-config.php'); // Change this for your path to wp-config.php file ?>

<ol id="whats-new">
<?
$news=$wpdb->get_results("SELECT `ID`,`post_title` FROM $wpdb->posts
WHERE `post_type`=\"post\" AND `post_status`=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
foreach($news as $np){
printf ("<li><a href=\"index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title);
}?>
</ol>
	
(Continues...)