Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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));
            ?>
                <ul>
                     <?php foreach ($stores as $categ_list): ?>
                        <li class="cats-<?php echo $categ_list->cat_ID; ?> dropcats">

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


            <?php       
                    $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; ?> 
                                        </a>
                                    </li>
                                <?php } ?>
                                 </li>
                            </ul>

            <?php   } 

                endforeach;
            ?>
            </ul>

        </aside>
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
add comment

Your Answer

 
discard

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.