CMS Mastering Development Wordpress

Use an HTML

I have a WP search form where I would like to add a <select> element for a particular taxonomy and its terms (salary bands) for a custom post type of ‘jobs’.

The current standard input search uses the following code to search the jobs custom post type for keywords:

<form method="get" action="<?php echo esc_url(site_url('/')); ?>">
    <div id="form-wrapper">
        <label id="searchlabel" for="s">Search</label>
        <input id="s" name="s" type="search">
        <input type="hidden" name="post_type" value="jobs" />
        <input class="td search-jobs-button" type="submit" value="Search Jobs">

How would I add a <select> element that will show custom salary taxonomies in salary bands (e.g: £20-40k, £40 – 60k, £60-80k etc). The taxonomy terms will be added in the back end of the site obviously.

What I would like to happen is for people to be able to search keywords in the search input field and effectively filter these results by salary band using the select options.

Is there any way of adding each salary banding to an individual select option which is then included in the search when they click the submit input button?

Leave a Reply

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