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 .

 args=array(
        'post_type'=>'product',
        'post_per_page'=>'10');

        $loop=new WP_Query($args);

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

        the_title();
        the_content();

        endwhile;

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.

 $args=array(
            'post_type'=>'product',
            'post_per_page'=>'10',
            'tax_query' => array(
                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


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: