Most Recent Post Per Category
I have a portfolio website with several categories and the portfolio page shows all of the posts in order of date. However, I would like to display the most recent post from each category first and then have all the rest display after. Here is the code from the portfolio template page.
<?php include_once (TEMPLATEPATH . '/title.php');?> <?php $values = get_post_custom_values("category-include"); $cat=$values; ?> <?php global $more; $more = 0;?> <?php $wp_query = new WP_Query(); ?> <?php $catinclude = 'portfoliocat='. $cat ;?> <?php $wp_query->query("post_type=portfolio" . '&' . $catinclude .' &paged='.$paged.'&posts_per_page=-1'); ?> <?php get_template_part( 'loop', 'portfolio' );?>
- The topic ‘Most Recent Post Per Category’ is closed to new replies.