WordPress Building simple lists using get_posts()
It’s really simple to build lists using the get_posts() method. Here’s an example of getting all the posts from a single category.
PHP
// Simple Lists
function get_simple_list($category) {
global $post;
$posts = get_posts('numberposts=5&category='.$category);
$html = '
'. get_cat_name($category) .'
';
$html .= '
- ';
foreach($posts as $post) :
setup_postdata($post);
$html .= '
- '; $html .= ''. the_title('','',false) .''; $html .= ' '; endforeach; $html .= '
Use
_e(get_simple_list(5)); // Where 5 is the category ID





…
Skoro eto sluchitsya …