This will give you something to look at:
<?php
//get categories, cycle through categories and if a category has posts, then get one post in that category and display it
$categories=get_categories();
if ($categories) {
foreach($categories as $category) {
if ($category->count > 0) {
echo 'Category <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> has ' . $category->count . ' post(s).
';
$number_posts_per_category = 1; //set =0 to see all posts in a category
$posts=get_posts('cat='. $category->term_id .'&showposts='.$number_posts_per_category);
foreach($posts as $post) {
setup_postdata($post); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php the_content();
}
}
}
}
?>
Thanks a lot, that works excellent.
How would i limit the_content(); to say 50 characters?
Use <--more--> in your posts,
or
use the template tag, the_excerpt() instead of the_content.