How to display on only subcategories and not parents.
-
When a user clicks on one of the left sidebar categories, I want it to take them to a page that first list all of that categories children (but not its parents), then displays all posts within that category.
So say, you had a tree like this:
News
-US News
–WA State News
—Seattle news
—-Redmond News
Asia News
-Korea News
–Seoul NewsOn the main page’s sidebar, the use can only see:
News
-US News
Asia News
-Korea NewsIf I click on US News, first it would display to the user
US News
-WA State News
–Seattle news
—Redmond News
Then it would show all the posts within US News.If I continued and clicked Seattle news, I would be presented with
Seattle News
-Redmond News
Then the posts within Seattle News.I’ve currently got this on my archives page, but I can’t seem to get it to do exactly what I want:
<p><?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?></p><?php list_cats(
0, //optional - boolean
'', //all - string
'name', //sort_column - string
'asc', //sort_order - string
'', //file - string
1, //list - boolean
0, //optiondates - boolean
0, //optioncount - boolean
1, //hide_empty - boolean
1, //use_desc_for_title - boolean
1 //children - boolean
1, //child_of - boolean
0, //categoires - integer
0, //recurse - boolean
'', //feed - string
'', //feed_image - string
'', //exclude - string
1 //hierarchical
); ?><?php while (have_posts()) : the_post(); ?>
<h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<p><?php the_excerpt() ?></p><?php endwhile; ?>
<p><?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?></p>
Any suggestion?
- The topic ‘How to display on only subcategories and not parents.’ is closed to new replies.