List by category and sub category & show category name
-
I’ve modified my loop to show a thumbnail and title only. So far, so good. The list is a list of all the posts from one category. Now I need to organize it. The list of posts now needs to be sorted by sub category. I’d like to list the sub category as a title for the section. This is one bit of code that I just cannot seem to find in the forum or on the internet.
Example:
Sub Category 1
-Lesson 1
-Lesson 2
Sub Category 2
-Lesson 1
-Lesson 2Here is my loop code so far:
<ul class="listofposts"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <li> <div class="list-title"<?php post_class() ?> id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <img src="<?php echo catch_that_image() ?>" width="50" height="50" align="middle"/> <?php the_title(); ?></a> </li> <?php endwhile; ?> </ul> <?php next_posts_link('« Older Entries') ?> <?php previous_posts_link('Newer Entries »') ?> </div><!-- closes .list-title --> <?php else : ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘List by category and sub category & show category name’ is closed to new replies.