• Resolved ferbis

    (@ferbis)


    Hi,

    I have made use of the shortcode [matador_jobs] to display a job listing on a website. I have specified that only one type of jobs would be displayed. So for example, we have jobs from types X, Y and Z which are imported from Bullhorn. On this website, I only want to make use of jobs from type X, so I have entered the shortcode [matador_jobs type=X]. Now it only shows jobs from type X.

    I want to add filters from either the selection menu shortcode or search shortcode to be able to filter jobs on this page. If I add such a shortcode on the same page, it also shows fields (such as location) as options from jobs of type Y and Z.

    How can I make sure these shortcodes will only show fields which are present in jobs from type X, and not types Y and Z?

Viewing 1 replies (of 1 total)
  • Plugin Author Jeremy Scott

    (@jeremyescott)

    Hi ferbis,

    Sorry for the delay. We had to look further into this.

    So, there are two problems here.

    The first is that the results of your [matador_jobs] shortcode query will be scoped to that shortcode only. The [matador_search] shortcode will exist outside of that scope, so it can’t know what is and isn’t in the current results.

    The second is that the [matador_search] drop-downs are populated using a WP_Term_Query which queries on the list of terms, not the list of terms belonging to posts within a query.

    Your request is not possible given core Matador shortcodes. It is possible with a bit of custom code. Here are some general steps you’d need to take:

    1. Make a taxonomy term archive for the types taxonomy.
    2. Loop through found posts querying the other taxonomies (locations, categories), and push taxonomy term IDs to an array.
    3. array_sort() and array_unique() the array of terms, build a drop down on the form field name matador_location or matador_category
    4. Then populate your jobs using the taxonomy term archive template
    5. Copy Matador’s pre_get_posts filter and apply it to the term archive to use our search logic and validation

    I know that is a lot!

    I could alternatively suggest a few sortable posts plugins that would grant your desired behavior via Javascript. We use the premium plugin Sort Table Pro by Barn 2 media (no referral benefit) and they have a powerful front-end, Javascript based filtering capability.

    I hope this helps. Sorry this isn’t easier to accomplish.

Viewing 1 replies (of 1 total)
  • The topic ‘How to make a filter show fields which are only present in displayed jobs?’ is closed to new replies.