Skip to main content
added 1146 characters in body; edited tags
Source Link
pjk_ok
  • 908
  • 2
  • 15
  • 35

I have custom post type that is currently using the wp_dropdown_categories() function within a WP search form so people will be able to filter by salary band and job type.

Is there an equivalent function so a user can apply filters with input checkbox elements instead of a <select> element, so they can choose more than one job type or salary level when undertaking a search?

I can't seem to find anything in the developer docs.

What I'm looking for is something to allow checkboxes that would replace the dropdown element that uses select options in the code below.

<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" />

            <?php wp_dropdown_categories( array(
                'taxonomy'        => 'salary_level', // taxonomy slug
                'name'            => 'salary_level', // taxonomy slug
                'class'           => 'jobsearch-select',
                'value_field'     => 'slug',
                'selected'        => get_query_var( 'salary_level' ),
                'hierarchical'    => true, // place each term under their own parent
                'show_option_all' => 'Select Salary Band',
            ) ); ?>
            
        <input class="td search-jobs-button" type="submit" value="Search Jobs">
    </div>
</form>

Thanks in advance

Emily.

I have custom post type that is currently using the wp_dropdown_categories() function within a WP search form so people will be able to filter by salary band and job type.

Is there an equivalent function so a user can apply filters with input checkbox elements instead of a <select> element, so they can choose more than one job type when undertaking a search?

I can't seem to find anything in the developer docs.

Thanks in advance

Emily.

I have custom post type that is currently using the wp_dropdown_categories() function within a WP search form so people will be able to filter by salary band and job type.

Is there an equivalent function so a user can apply filters with input checkbox elements instead of a <select> element, so they can choose more than one job type or salary level when undertaking a search?

I can't seem to find anything in the developer docs.

What I'm looking for is something to allow checkboxes that would replace the dropdown element that uses select options in the code below.

<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" />

            <?php wp_dropdown_categories( array(
                'taxonomy'        => 'salary_level', // taxonomy slug
                'name'            => 'salary_level', // taxonomy slug
                'class'           => 'jobsearch-select',
                'value_field'     => 'slug',
                'selected'        => get_query_var( 'salary_level' ),
                'hierarchical'    => true, // place each term under their own parent
                'show_option_all' => 'Select Salary Band',
            ) ); ?>
            
        <input class="td search-jobs-button" type="submit" value="Search Jobs">
    </div>
</form>

Thanks in advance

Emily.

Source Link
pjk_ok
  • 908
  • 2
  • 15
  • 35

Is there An Input Checkbox Option That Works like `wp_dropdown_categories()` To Use In A WP Search Form?

I have custom post type that is currently using the wp_dropdown_categories() function within a WP search form so people will be able to filter by salary band and job type.

Is there an equivalent function so a user can apply filters with input checkbox elements instead of a <select> element, so they can choose more than one job type when undertaking a search?

I can't seem to find anything in the developer docs.

Thanks in advance

Emily.