Search Filter in Snippet
-
There is a code for a search page, which makes dropdown option in the location field. However, instead of inserting this code in the ‘job_filters.php’ I would like to insert it through a snippet. Can anyone add few lines of code to being valid as a 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; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Search Filter in Snippet’ is closed to new replies.