Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. if(!function_exists('ct_search_form_select')) {
  2. function ct_search_form_select($name, $taxonomy_name = null) {
  3. global $search_values;
  4. global $ct_options;
  5.  
  6. $ct_zip_or_post = isset( $ct_options['ct_zip_or_post'] ) ? $ct_options['ct_zip_or_post'] : '';
  7. $ct_city_town_or_village = isset( $ct_options['ct_city_town_or_village'] ) ? $ct_options['ct_city_town_or_village'] : '';
  8. $ct_state_or_area = isset( $ct_options['ct_state_or_area'] ) ? $ct_options['ct_state_or_area'] : '';
  9. $ct_community_neighborhood_or_district = isset( $ct_options['ct_community_neighborhood_or_district'] ) ? $ct_options['ct_community_neighborhood_or_district'] : '';
  10.  
  11. if(!$taxonomy_name) {
  12. $taxonomy_name = $name;
  13. $tax_label = str_replace('_', ' ', $name);
  14. $tax_name_stripped = str_replace('ct ', '', $tax_label);
  15.  
  16. if($tax_name_stripped == 'property type') {
  17. $tax_name = __('Property Type', 'contempo');
  18. } elseif($tax_name_stripped == 'country') {
  19. $tax_name = __('Country', 'contempo');
  20. } elseif($tax_name_stripped == 'county') {
  21. $tax_name = __('County', 'contempo');
  22. } elseif($tax_name_stripped == 'city' && $ct_city_town_or_village == 'town') {
  23. $tax_name = __('Town', 'contempo');
  24. } elseif($tax_name_stripped == 'city' && $ct_city_town_or_village == 'village') {
  25. $tax_name = __('Village', 'contempo');
  26. } elseif($tax_name_stripped == 'city') {
  27. $tax_name = __('City', 'contempo');
  28. } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'area') {
  29. $tax_name = __('Area', 'contempo');
  30. } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'suburb') {
  31. $tax_name = __('Suburb', 'contempo');
  32. } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'province') {
  33. $tax_name = __('Province', 'contempo');
  34. } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'region') {
  35. $tax_name = __('Region', 'contempo');
  36. } elseif($tax_name_stripped == 'state' && $ct_state_or_area == 'parish') {
  37. $tax_name = __('Parish', 'contempo');
  38. } elseif($tax_name_stripped == 'state') {
  39. $tax_name = __('State', 'contempo');
  40. } elseif($tax_name_stripped == 'beds') {
  41. $tax_name = __('Beds', 'contempo');
  42. } elseif($tax_name_stripped == 'baths') {
  43. $tax_name = __('Baths', 'contempo');
  44. } elseif($tax_name_stripped == 'status') {
  45. $tax_name = __('Status', 'contempo');
  46. } elseif($tax_name_stripped == 'additional features') {
  47. $tax_name = __('Additional Features', 'contempo');
  48. } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'neighborhood') {
  49. $tax_name = __('Neighborhood', 'contempo');
  50. } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'district') {
  51. $tax_name = __('District', 'contempo');
  52. } elseif($tax_name_stripped == 'schooldistrict' && $ct_community_neighborhood_or_district == 'schooldistrict') {
  53. $tax_name = __('School District', 'contempo');
  54. } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'suburb') {
  55. $tax_name = __('Suburb', 'contempo');
  56. } elseif($tax_name_stripped == 'community' && $ct_community_neighborhood_or_district == 'building') {
  57. $tax_name = __('Building', 'contempo');
  58. } elseif($tax_name_stripped == 'community') {
  59. $tax_name = __('Community', 'contempo');
  60. } elseif($tax_name_stripped == 'zipcode' && $ct_zip_or_post == 'postcode') {
  61. $tax_name = __('Postcode', 'contempo');
  62. } elseif($tax_name_stripped == 'zipcode' && $ct_zip_or_post == 'postalcode') {
  63. $tax_name = __('Postal Code', 'contempo');
  64. } elseif($tax_name_stripped == 'zipcode') {
  65. $tax_name = __('Zipcode', 'contempo');
  66. } elseif($tax_name_stripped == 'pet friendly') {
  67. $tax_name = __('Pet Friendly?', 'contempo');
  68. } elseif($tax_name_stripped == 'furnished unfurnished') {
  69. $tax_name = __('Furnished/Unfurnished?', 'contempo');
  70. }
  71. } ?>
  72. <?php
  73. if($name=="status")
  74. {?>
  75. <select id="ct_<?php echo esc_html($name); ?>" name="ct_<?php echo esc_html($name); ?>" class="required">
  76. <option value="0"><?php echo esc_html(ucfirst($tax_name)); ?></option>
  77. <?php foreach( get_terms($taxonomy_name, 'hide_empty=true') as $t ) : ?>
  78. <?php if ($search_values[$name] == $t->slug) { $selected = 'selected=selected '; } else { $selected = ''; } ?>
  79. <option <?php echo esc_html($selected); ?>value="<?php echo esc_attr($t->slug); ?>"><?php echo esc_html($t->name); ?></option>
  80. <?php endforeach; ?>
  81. </select>
  82. <?php }
  83. else{
  84. ?>
  85. <select id="ct_<?php echo esc_html($name); ?>" name="ct_<?php echo esc_html($name); ?>">
  86. <option value="0"><?php echo esc_html(ucfirst($tax_name)); ?></option>
  87. <?php foreach( get_terms($taxonomy_name, 'hide_empty=true') as $t ) : ?>
  88. <?php if ($search_values[$name] == $t->slug) { $selected = 'selected=selected '; } else { $selected = ''; } ?>
  89. <option <?php echo esc_html($selected); ?>value="<?php echo esc_attr($t->slug); ?>"><?php echo esc_html($t->name); ?></option>
  90. <?php endforeach; ?>
  91. </select>
  92. ?>
  93. <?php
  94. }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement