Ok, after reading your posts I realized I’ve done this before. Told ya I’ve been away too long! I have tweaked my code from the other Page, and it’s working — but I have one other thing I want to do, and I’m not sure how to get there.
<?php
$results = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent FROM ".$wpdb->categories." WHERE cat_ID = '29' ORDER BY cat_ID ");
?>
<?php foreach($results as $cat){ ?>
<a href="<?php echo get_category_link($cat->cat_ID); ?>">
<?php echo $cat->cat_name; ?></a>
<?php query_posts('category_name='. $cat->cat_name . '&showposts=-1&order=ASC'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<? }?>
This ends up something like this:
PARENT_CATEGORY_NAME (link)
* Linkified Post Title
* Linkified Post Title
* Linkified Post Title
* Linkified Post Title
Very nice. I’m almost there.
Now what I want it to do is display the child categories above their respective posts. So the posts are sorted under the child categories to which they belong. (It’s ignoring child/parent relationships, and just displaying the parent category name.) Does that make sense?
Any help would be greatly appreciated.
PS I know the code isn’t very clean. I didn’t write it, I copied it, and all attempts to clean it up failed, so I went back to what worked. It wasn’t broke, so……
And please, would someone tell me how to post code in this forum so I don’t have to edit a thousand times? Backticks only seem to work around single lines of code, and code tags don’t seem to work the way I expect them to. Thanks!!