Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!function_exists('ct_search_form_select')) {
- function ct_search_form_select($name, $taxonomy_name = null) {
- global $search_values;
- global $ct_options;
- $ct_zip_or_post = isset( $ct_options['ct_zip_or_post'] ) ? $ct_options['ct_zip_or_post'] : '';
- $ct_city_town_or_village = isset( $ct_options['ct_city_town_or_village'] ) ? $ct_options['ct_city_town_or_village'] : '';
- $ct_state_or_area = isset( $ct_options['ct_state_or_area'] ) ? $ct_options['ct_state_or_area'] : '';
- $ct_community_neighborhood_or_district = isset( $ct_options['ct_community_neighborhood_or_district'] ) ? $ct_options['ct_community_neighborhood_or_district'] : '';
- if(!$taxonomy_name) {
- $taxonomy_name = $name;
- $tax_label = str_replace('_', ' ', $name);
- $tax_name_stripped = str_replace('ct ', '', $tax_label);
- if($tax_name_stripped == 'property type') {
- $tax_name = __('Property Type', 'contempo');
- } elseif($tax_name_stripped == 'country') {
- $tax_name = __('Country', 'contempo');
- } elseif($tax_name_stripped == 'county') {
- $tax_name = __('County', 'contempo');
- } elseif($tax_name_stripped == 'city' && $ct_city_town_or_village == 'town') {
- $tax_name = __('Town', 'contempo');
- } elseif($tax_name_stripped == 'city' && $ct_city_town_or_village == 'village') {
- $tax_name = __('Village', 'contempo');
- } elseif($tax_name_stripped == 'city') {
- $tax_name = __('City', 'contempo');
- } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'area') {
- $tax_name = __('Area', 'contempo');
- } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'suburb') {
- $tax_name = __('Suburb', 'contempo');
- } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'province') {
- $tax_name = __('Province', 'contempo');
- } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'region') {
- $tax_name = __('Region', 'contempo');
- } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'parish') {
- $tax_name = __('Parish', 'contempo');
- } elseif($tax_name_stripped == 'state') {
- $tax_name = __('State', 'contempo');
- } elseif($tax_name_stripped == 'beds') {
- $tax_name = __('Beds', 'contempo');
- } elseif($tax_name_stripped == 'baths') {
- $tax_name = __('Baths', 'contempo');
- } elseif($tax_name_stripped == 'status') {
- $tax_name = __('Status', 'contempo');
- } elseif($tax_name_stripped == 'additional features') {
- $tax_name = __('Additional Features', 'contempo');
- } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'neighborhood') {
- $tax_name = __('Neighborhood', 'contempo');
- } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'district') {
- $tax_name = __('District', 'contempo');
- } elseif($tax_name_stripped == 'schooldistrict' && $ct_community_neighborhood_or_district == 'schooldistrict') {
- $tax_name = __('School District', 'contempo');
- } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'suburb') {
- $tax_name = __('Suburb', 'contempo');
- } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'building') {
- $tax_name = __('Building', 'contempo');
- } elseif($tax_name_stripped == 'community') {
- $tax_name = __('Community', 'contempo');
- } elseif($tax_name_stripped == 'zipcode' && $ct_zip_or_post == 'postcode') {
- $tax_name = __('Postcode', 'contempo');
- } elseif($tax_name_stripped == 'zipcode' && $ct_zip_or_post == 'postalcode') {
- $tax_name = __('Postal Code', 'contempo');
- } elseif($tax_name_stripped == 'zipcode') {
- $tax_name = __('Zipcode', 'contempo');
- } elseif($tax_name_stripped == 'pet friendly') {
- $tax_name = __('Pet Friendly?', 'contempo');
- } elseif($tax_name_stripped == 'furnished unfurnished') {
- $tax_name = __('Furnished/Unfurnished?', 'contempo');
- }
- } ?>
- <?php
- if($name=="status")
- {?>
- <select id="ct_<?php echo esc_html($name); ?>" name="ct_<?php echo esc_html($name); ?>" class="required">
- <option value="0"><?php echo esc_html(ucfirst($tax_name)); ?></option>
- <?php foreach( get_terms($taxonomy_name, 'hide_empty=true') as $t ) : ?>
- <?php if ($search_values[$name] == $t->slug) { $selected = 'selected=selected '; } else { $selected = ''; } ?>
- <option <?php echo esc_html($selected); ?>value="<?php echo esc_attr($t->slug); ?>"><?php echo esc_html($t->name); ?></option>
- <?php endforeach; ?>
- </select>
- <?php }
- else{
- ?>
- <select id="ct_<?php echo esc_html($name); ?>" name="ct_<?php echo esc_html($name); ?>">
- <option value="0"><?php echo esc_html(ucfirst($tax_name)); ?></option>
- <?php foreach( get_terms($taxonomy_name, 'hide_empty=true') as $t ) : ?>
- <?php if ($search_values[$name] == $t->slug) { $selected = 'selected=selected '; } else { $selected = ''; } ?>
- <option <?php echo esc_html($selected); ?>value="<?php echo esc_attr($t->slug); ?>"><?php echo esc_html($t->name); ?></option>
- <?php endforeach; ?>
- </select>
- ?>
- <?php
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement