Search form add remove input fields

You can add or remove input fields as you want, please use following action hook to remove input fields

 

// remove keyword
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_keyword');

// remove categories
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_categories', 20);

// remove salary_type
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_salary_type', 30);

// remove salary_range
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_salary_range', 30);

// remove job_type
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_job_type', 30);

// remove job_level
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_job_level', 30);

// remove job_status
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_job_status', 30);

// remove company
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_company', 45);

// remove location
remove_action('job_bm_job_search_form', 'job_bm_job_search_form_location', 45);

 

You can add these codes to your theme functions.php file.

Add new input fields

Same ay you can add custom input field to search form, see the sample code her.

add_action('job_bm_job_search_form', 'job_bm_job_search_form_custom_field', 50);

function job_bm_job_search_form_custom_field(){

    $job_bm_custom_field = isset($_GET['custom_field']) ? sanitize_text_field($_GET['custom_field']) : "";

    ?>
    <div class="form-field-wrap">
        <div class="field-title">
            <?php _e('Custom input title','job-board-manager'); ?>
            <span class="field-details" title="<?php _e('Custom input field details','job-board-manager'); ?>"><i class="far fa-question-circle"></i></span>

        </div>
        <div class="field-input">
            <input class="custom_field" placeholder="Custom data" type="text" value="<?php echo $job_bm_custom_field; ?>" name="custom_field">
        </div>
    </div>
    <?php
}

View post on imgur.com

Process custom field data

You need to use following filter hook for process form data to query jobs

https://pickplugins.com/documentation/job-board-manager/filter-hooks/job_bm_job_archive_query_args/

 

add_filter('job_bm_job_archive_query_args', 'job_bm_job_archive_query_args_custom_field');
function job_bm_job_archive_query_args_custom_field($query_args){

    $custom_field = isset($_GET['custom_field']) ? sanitize_text_field($_GET['custom_field']) : "";


    // use for search.
    $query_args['s'] = $custom_field;

    // you can use any query arguments supported by WP_Query class
    // https://developer.wordpress.org/reference/classes/wp_query/

    return $query_args;
}

View post on imgur.com