Hello I am doing a school project and creating a website for photographer.
I have little problem about showing subcategories in sidebar

I have total three categories, and a lot of subcategories.
I am using hierarchical categories and I am happy with that but,it’s not so cool to show all subcategories. Visitors will be tired to scroll down.

I want show list of subcategories just when I have clicked the category or some (may be + button?) button. It should be allowable to hide them when the list of subcategories is opened.

Please anybody can help me?
This is my sidebar.php code

<div class="sidebar">

<?php 
    if (is_active_sidebar('sidebar')) { 

        dynamic_sidebar('sidebar'); 

    } else { // Fallback if the sideabr widget area is empty

        echo '<div class="widgets">';

        the_widget( 'WP_Widget_Search', 
            array(

            ),
            array(
                'before_title' => '<h3 class="widget-title">',
                'after_title' => '</h3>',
                'before_widget' => '<div class="widget widget_search"><div class="widget-content">',
                'after_widget' => '</div><div class="clear"></div></div>'
            ) 
        );

        the_widget( 'rowling_recent_posts', 
            array(
                'number_of_posts'   =>  '5',
                'widget_title'      =>  __('Recent Posts','rowling'),
            ),
            array(
                'before_title' => '<h3 class="widget-title">',
                'after_title' => '</h3>',
                'before_widget' => '<div class="widget widget_rowling_recent_posts"><div class="widget-content">',
                'after_widget' => '</div><div class="clear"></div></div>'
            ) 
        );

        the_widget( 'WP_Widget_Categories', 
            array(
                'count'         =>  '1',
                'hierarchical'  =>  '1',
            ),
            array(
                'before_title' => '<h3 class="widget-title">',
                'after_title' => '</h3>',
                'before_widget' => '<div class="widget widget_categories"><div class="widget-content">',
                'after_widget' => '</div><div class="clear"></div></div>'
            ) 
        );

        the_widget( 'WP_Widget_Archives', 
            array(
                'count'         =>  '1',
                'hierarchical'  =>  '1',
            ),
            array(
                'before_title' => '<h3 class="widget-title">',
                'after_title' => '</h3>',
                'before_widget' => '<div class="widget widget_archive"><div class="widget-content">',
                'after_widget' => '</div><div class="clear"></div></div>'
            ) 
        );

        echo '</div>';

    }
?>

Plugins can be also very useful but I don’t know which one to download

Read more here: how to show subcategories by clicking the category or some button in side bar?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: