0

I have searched a lot but couldn't find any plugin that can show list of product categories in sidebar and by clicking on category name products of that category appear below category name just like drop down OR better would be in toggle form.

During my search I did find a similar plugin. Functionality of this plugin is nearly as per my requirements. But the problem is that its showing product in dropdown form and I want it to show in toggle form, something like this. See the left sidebar in which products category shows and by clicking on it, it shows products of that category.

Although in my given link its toggle only sub-category by clicking on category But I want to toggle Products when clicking on category.

Any Idea of any similar plugin?

0

I didn't find any exact same match of my requirements as a plugin. No such plugins are available as per my search. So I did solve my problem with code instead of plugin.

Here is how I did achieve this without plugin (Because couldn't find any)

I did search for Accordion example and found many on google. I pick one example out of many available according to my interest.

Then I gave title to each toggle as category name of product and In content of accordion I did use while loop to show list of products so that I can get my all products dynamically.

I use separate loop for separate category. Here is an example of loop that is being use to show category, named as category_1

<?php
$args = array(
    'post_type' => 'product',   //Specifying post type as product to show all products
    'posts_per_page' => -1,     //No. of products per page, -1 if for linfiniy products
    'product_cat' => 'category_1',   //Specifying categories of products by its slug name
    'orderby' => array('menu_order' => 'ASC', 'title' => 'ASC')   //Specifying product should be appear in menu order.
    );
$loop = new WP_Query( $args );
?> <ul>
<?php    
if ( $loop->have_posts() ) {
    while ( $loop->have_posts() ) : $loop->the_post(); 
    //Showing title of product (Product name)?> 
    <li style="list-style:none;text-align:left;font-size: 12px;"><a href="<?php the_permalink(); ?>" style="color:#82c0c7;"><?php the_title(); ?></a></li> <?php
    endwhile;
}
wp_reset_postdata();
?>
</ul>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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