WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Because there is no category option on pages I desided to add post category to main nav. I added the category and added posts on it but it doesn't dsplays the sub category on menu. what should I do to make it work?

Another thing is If I am inside one of the post/page of a category I want to display all the page / post menu on left side bar.

Thanks in advance

share|improve this question

I had put the following code into sidebar.php to display a list eith sub-categories of "Store" categori and the posts of them. Hope I understand what you need and it will be helpfull. if not can ask more explicite

                // Get categories for parent category store
                // Get ID cat by slug
                $id_store = get_category_id('store');

                $stores = get_categories(array('child_of' => $id_store, 'hide_empty' => 0));
                     <?php foreach ($stores as $categ_list): ?>
                        <li class="cats-<?php echo $categ_list->cat_ID; ?> dropcats">

                                <?php echo $categ_list->cat_name; ?>

                    $args = array(
                        'category' => $categ_list->cat_ID,
                        'numberposts' => -1,
                        'orderby' => 'title',
                        'order' => 'asc'

                    // Get posts for store category

                    $store_posts = get_posts($args);
                    // If there is any posts
                    if (count($store_posts) > 0) {

                            <ul class="markes">
                                <?php foreach ($store_posts as $post) { ?>              
                                    <li class="post-<?php echo $post->ID; ?>">
                                        <a href="<?php echo $post->post_name; ?>" class="marke-<?php echo $post->ID;?>">
                                            <?php echo $post->post_name; ?> 
                                <?php } ?>

            <?php   } 


share|improve this answer
I added a plugin called "Sub Pages widget". it worked for me. Here is the link – kamal Aug 21 '11 at 9:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.