creating parent category and subcategory list in sidebar
-
Hi I am using code below in my sidebar.php to list posts from a category when on that category. It also lists posts from child category if there is one.
What I would like to do is add a current menu item class to the list items
I would also like to be able to indent the list items for child category posts
e.g
parent category post 1
parent category post 2
> indent child category post 1
> indent child category post 2
parent category post 3<?php global $post; $categories = get_the_category(); foreach ($categories as $category) : ?> <h3 class="categories-menuheading">Menu</h3> <?php endforeach; ?> <ul id="kbo-category-menus"> <?php $posts = get_posts('numberposts=20&category='. $category->term_id); foreach($posts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘creating parent category and subcategory list in sidebar’ is closed to new replies.