logo

This is an old version of this answer!

Return to the current answer
Starting at

if ( is_page('Sports') ) { 
$cat = 6; //sports category id
$children = get_term_children( $cat );
if( is_array( $children ) && !empty( $children ) ) {
foreach( $children as $child ) {
query_posts( 'cat=' . $child );
if( have_posts() ) { ?>
<h4><a href="<?php echo get_category_link( $child ); ?>"><?php echo get_cat_name( $child ); ?></a></h4>
<ul>
<?php while( have_posts() ) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php // This is the implementation of custom write panels.

$data = get_post_meta( $post->ID, 'module', true ); ?>

<span class="listing-entry organization"><?php echo $data[ 'organization' ]; ?></span>

<span class="read-more">(read more)</span>

</a></li>
<?php endwhile; ?>
</ul>
<?php
}
}
}
?>


The post limit on this will be whatever is set in your reading settings for the number of posts to show. If you want to show just 4 post titles per category then add

showposts=4


to the query_posts.

Ron Rennick | 12/27/09 at 11:19pm

This is an old version of this answer!

Return to the current answer