wordpress post filter using Ajax

I created a new post type called products and i create a new taxonmy for this product called product_cat.

register_taxonomy( 'product_cat', array( 'product' ), $args );

In the product_cat i have added car ,ship,boat,bus etc.

Now i am listing all the product using following code .


        $loop=new WP_Query($args);

        while($loop->have_posts()) : $loop->the_post();



I want to make a product filter now .For this i added the following html

<label class="type-label">car<input type="checkbox" class="type-box" value="car"/></label>
<label class="type-label">bus<input type="checkbox" class="type-box" value="bus"/></label>  

What i need is, when someone clicking the car then then car products only need to show .

I know the jquery code to fetch the value of check box . i know how to list car product.

            'tax_query' => array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug',
                'terms'    => 'car',
$loop=new WP_Query($args); 

But please any one help to show the corresponding result using ajax . That is when some one clicking the car check box then only product in car category need to show.

Please help friends.

Read more here: wordpress post filter using Ajax

Leave a Reply

Your email address will not be published. Required fields are marked *