pre_get_posts - set queries hierachy

by Marek Paczkowski   Last Updated September 13, 2017 12:08 PM

I made a form with such a code:

<form name="wyszukiwarka" id="wyszukiwarka" class="wyszukiwarka" >
    <select class="miasto" id="pa_miasto" name="pa_miasto">
        <option class='opcja' value='miastoValue'>MiastoValue</option>
    <select class="typ-ogloszenia" id="product_cat" name="product_cat" required >     
        <option class='opcja' value='ProductCatValue'>TypValue</option>

    <input type="submit" value = "Szukaj" >

I'd like to set hierarchy for my query.

My form should use the value of product_cat first to get into a proper category and then use the value of pa_miasto to set query among chosen category only.

Can i do this with a pre_get_posts hook? Any other solution?

Related Questions

Which php file lists all the post of a category

Updated November 12, 2016 08:03 AM

How to display custom post type?

Updated November 06, 2016 08:03 AM

Wordpress Subcategory template

Updated November 25, 2016 08:03 AM

Different template for subcategories

Updated November 25, 2016 08:03 AM