pickled
Member
Posted 5 years ago #
I'd like to show 5 post titles per category on the home page of my blog with each categories titles grouped together.
Anyone know the best way to do this with WP?
So I'd have groups like:
Recent Work
1)
2)
3)
4)
5)
Recent Family Fun
1)
2)
3)
4)
5)
etc.
Thanks!
fluentdesigns
Member
Posted 5 years ago #
Im actually looking to do the same thing but have had no luck with someone replying.
fluentdesigns
Member
Posted 5 years ago #
pickled
Member
Posted 5 years ago #
jeez, where are the helpful people at? this must be a common request.
pickled
Member
Posted 5 years ago #
pleeeze....anyone got a tip here?
seriously - the codex explains it perfectly. why repeat something here, when you've been given a direct place to get your answer?
I found a link to this plugin by going to the codex... not sure if its exactly what you're looking for, but check it out. http://www.coffee2code.com/wp-plugins/#customizablepostlistings
richsipe
Member
Posted 5 years ago #
Here is a good start for you. This will work if you want to pick out certain categories (X) and display the 5 posts for them. You can also do this for all categories:
<?php $cat_id = X;
$cat_name = get_cat_name($cat_id);
echo ($cat_name . "");
$posts = get_posts( "category=10&numberposts=5" ); ?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<div><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></div>
<?php endforeach; ?>
<?php endif; ?>
The above is just quickly cobled together. You will need to adjust it for your needs and make the ul etc but it should get you started at least knowing what functions to call.
--[moderated sig]--