I am using the Page2Cat plug in (http://wordpress.org/extend/plugins/page2cat/) and I am using the new feature to list the posts in each category. I've managed to make it look exactly like I want it, except I want the posts to display in date order, the oldest at the top and the newest at the bottom.
I can't quite decipher how to do in the code for it:
// filter the content of a page, check for tag and replace it with a list of posts in the requested category.
// function heavily inspired from Alex Rabe NextGen Gallery's nggfunctions.php.
function page2cat_content_catlist($content){
global $post;
if ( stristr( $content, '[catlist' )) {
$search = "@(?:<p>)*\s*\[catlist\s*=\s*(\w+|^\+)\]\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches)) {
if (is_array($matches)) {
$title = get_option('p2c_catlist_title');
if($title != "") $output = "<p><h3>".$title."</h3>"; else $output = "";
$output .= "<ul class='p2c_catlist'>";
$limit = get_option('p2c_catlist_limit');
foreach ($matches[1] as $key =>$v0) {
$catposts = get_posts('category='.$v0."&numberposts=".$limit);
foreach($catposts as $single):
$output .= "<li><a href='".get_permalink($single->ID)."'>".$single->post_title."</a></li>";
endforeach;
$search = $matches[0][$key];
$replace= $output;
$content= str_replace ($search, $replace, $content);
}
$output .= "</ul></p>";
}
}
}
return $content;
}
I'd rather not mess with it more than I already have. Thanks!