Output dropdown in Job Filters/Search page for job_location (when configured as dropdown type) for WP Job Manager Field Editor

job-filters.php

<?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; ?>
No comments yet.

Leave a Reply