Output dropdown in Job Filters/Search page for job_location
-
How can you list jobs as a dropdown instead of an input search field with a template override in job-filters.php.
I’ve tried the following code snippet:
<?php $job_locations = get_custom_field_config( 'job_location', 'options' ); if ( is_array( $job_locations ) ): ?> <select class="" name="search_location" id="search_location"> <option value="" <?php selected( empty( $location ) || ! in_array( $location, $job_locations ) ); ?>><?php _e( 'Any Location' ); ?></option> <?php foreach( $job_locations as $loc_val => $loc_label ): ?> <option value="<?php echo esc_attr( $loc_val ); ?>" <?php selected( $location, $loc_val ); ?>><?php echo esc_attr( $loc_label ); ?></option> <?php endforeach; ?> </select> <?php endif; ?>
Thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Output dropdown in Job Filters/Search page for job_location’ is closed to new replies.