0
votes

I am working on a job site on which jobs will have categories titles like, salary, Sector, Location etc. The idea is to enable a visitor to filter out posts by selecting appropriate checkboxes for all these three categories and show the posts which contains category parameters chosen by the user. Here is an example of what i am looking for : http://underwearking.nl/heren/ (see the left sidebar)

I have gone through over 200 plugins and searched wordpress thoroughly but i am unable to find any plugin which fulfills this. Also, I don't know much about coding but i know that it involves something like integration of jQuery Ajax and checkboxes... Can someone please help me???

1
Hi, it maybe by this plugin, codecanyon.net/item/taxonomies-filter-widget/… It's a commercial plugin which $16bard

1 Answers

1
votes

This is a very broad question and as such cannot be answered with much concrete code.

Here are some guidelines though:

a. You need to look at custom taxonomies and the way the WP_Query object interacts with it. A taxonomy is a method of classification by a certain parameter - in your case salary level, sector, location etc.

b. To achieve the asynchronous effect demonstrated by your link, you need to use AJAX, in order to retrieve the relevant information. You should send the AJAX request in response to the onchange event of any checkbox.

c. Then you send all the checked values to the server and run a query for all the posts matching those values, using the taxonomy parameters.

The query would be something along these lines:

$args = array(
    'post_type' => 'post',
    'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'salary',
            'field' => 'slug',
            'terms' => array( 'high', 'low' )
        ),
        array(
            'taxonomy' => 'sector',
            'field' => 'slug',
            'terms' => array( 'private' ),
        )
    )
);

$query = new WP_Query( $args );

d. Lastly, use the data that you receive from the server to repopulate the list of jobs accordingly.

Last note: Plugins aren't very helpful when it comes to complicated functionalities that require custom tailored solutions.