Return only one Job Type checked: WP Job Manager

I’m using WP Job Manager for a client and when the [Jobs] page initially opens they would like people to be able to search using the “Job Type” checkbox but they want either no boxes checked initially or only the most common one checked. Below is the code from the fob-filter-job-types.php file.

<?php   if ( ! is_tax( 'job_listing_type' ) && empty( $job_types ) ) : ?>
    <ul class="job_types">
        <?php foreach ( get_job_listing_types() as $type ) : ?>
            <li><label for="job_type_<?php echo $type->slug; ?>" class="<?php echo sanitize_title( $type->name ); ?>"><input type="checkbox" name="filter_job_type[]" value="<?php echo $type->slug; ?>" <?php checked( in_array( $type->slug, $selected_job_types ), true ); ?> id="job_type_<?php echo $type->slug; ?>" /> <?php echo $type->name; ?></label></li>
        <?php endforeach; ?>
    <input type="hidden" name="filter_job_type[]" value="" />
<?php elseif ( $job_types ) : ?>
    <?php foreach ( $job_types as $job_type ) : ?>
        <input type="hidden" name="filter_job_type[]" value="<?php echo sanitize_title( $job_type ); ?>" />
    <?php endforeach; ?>
<?php endif;    ?>

Read more here: Return only one Job Type checked: WP Job Manager

Leave a Reply

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