Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $cat = 'Work';
- $catID = get_cat_ID($cat);
- $subcats = get_categories('child_of=' . $catID);
- foreach($subcats as $subcat) {
- echo '<h3>';
- echo '<a href="' . get_category_link($subcat->cat_ID) . '">';
- echo '/' . $subcat->cat_name . '';
- echo '</a></h3>';
- echo '<ul>';
- $subcat_posts = get_posts('cat=' . $subcat->cat_ID);
- foreach($subcat_posts as $subcat_post) {
- $postID = $subcat_post->ID;
- echo '<li>';
- echo '<a href="' . get_permalink($postID) . '">';
- echo get_the_title($postID);
- echo '</a></li>';
- }
- echo '</ul>';
- } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement