| name | language | licence |
|---|---|---|
| Adding a Mini-Loop | PHP | Other |
| Untitled Snippet | PHP | Other |
| translations of CSS3 selectors for SocialMe | PHP | Other |
| Template Tags/wp list bookmarks | PHP | Other |
| Unique Category template | PHP | Other |
| Display Google Ad after the first post | PHP | Other |
| Custom Fields | PHP | Other |
| Dynamic Content Dynamic Content | PHP | Other |
< 1 2 3 >
language: PHP
licence: Other
Adding a Mini-Loop
options: view full snippet • send 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>



library
buttons (3)
wp (93)