Guest User

Untitled

a guest
Jun 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. <?php if(get_option("quicklsearch") == "1") { ?>
  2. <div class="quicksearch">
  3. <script type="text/javascript">
  4. jQuery(document).ready(function($) {
  5. // get cities from the selected country in dropdown
  6. var c = ".search-cities-input";
  7. var parent_div = ".quicksearch";
  8. var country = $(c).val();
  9. <?php if(showfield('city')) { ?>
  10. var city_div = '.search-states-input';
  11.  
  12. var city_c = '#city';
  13. var city_div = '.search-cities-input';
  14. <?php } else { ?>
  15. var city_div = '.search-cities-input';
  16. <?php } ?>
  17.  
  18. if(country > 0) { show_search_cities(c); }
  19. $(parent_div+' '+c).change(function(){ show_search_cities(c); });
  20. function show_search_cities(e) {
  21. var country = $(parent_div+' '+e).val();
  22. $(parent_div+' '+city_div).text('');
  23. <?php if(showfield('city')) { ?>
  24. $(parent_div+' '+city_div).text('');
  25. <?php } ?>
  26.  
  27. if(city < 1) return true;
  28.  
  29. loader($(e).parents(parent_div).find(city_div));
  30. $.ajax({
  31. type: "GET",
  32. url: "<?php bloginfo('template_url'); ?>/ajax/cities.php",
  33. <?php if(showfield('city')) { ?>
  34. data: "id=" + country +"&selected=<?php echo $state ?>&hide_empty=1&class=col100&state=yes&select2=yes",
  35. <?php } else { ?>
  36. data: "id=" + country +"&selected=<?php echo $city ?>&hide_empty=1&class=col100&select2=yes",
  37. <?php } ?>
  38. success: function(data){
  39. $(e).parents(parent_div).find(city_div).html(data + '<div class="formseparator"><'+'/div>');
  40. if($(window).width() > "960") { $('.select2').select2(); }
  41. }
  42. });
  43. }
  44.  
  45. <?php if(showfield('city')) { ?>
  46. $(parent_div).on("change", city_c, function(){
  47. show_search_cities_when_cities(city_c);
  48. });
  49. function show_search_cities_when_cities(e) {
  50. var state = $(parent_div+' '+e).val();
  51. $(parent_div+' '+city_div).text('');
  52. if(state < 1) {
  53. return true;
  54. }
  55.  
  56. loader($(e).parents(parent_div).find(state_div));
  57. $.ajax({
  58. type: "GET",
  59. url: "<?php bloginfo('template_url'); ?>/ajax/cities.php",
  60. data: "id=" + state +"&selected=<?php echo $city ?>&hide_empty=1&class=col100&select2=yes",
  61. success: function(data){
  62. $(e).parents(parent_div).find(state_div).html(data + '<div class="formseparator"><'+'/div>');
  63. if($(window).width() > "960") { $('.select2').select2(); }
  64. }
  65. });
  66. }
  67. <?php } // if showfield('state') ?>
  68.  
  69.  
  70. });
  71. </script>
  72.  
  73.  
  74.  
  75. <form action="<?php echo get_permalink(get_option('search_page_id')); ?>" method="post" class="search-menu">
  76. <input type="hidden" name="action" value="search" />
  77.  
  78. <div class="form-input l ">
  79. <select name="gender" class="select2 drp-gender">
  80. <option value="">Seeking a...</option>
  81. <?php foreach($gender_a as $key=>$gender) { if(in_array($key, $settings_theme_genders)) { echo '<option value="'.$key.'">'.$gender.'</option>'; } } ?>
  82. </select>
  83. </div> <!-- gender -->
  84. <div class="clear-width"></div>
  85.  
  86. <div class="form-input l">
  87.  
  88.  
  89. <?php
  90. $args = array(
  91. 'show_option_none' => 'Located in...',
  92. 'orderby' => 'name',
  93. 'order' => 'ASC',
  94. 'show_last_update' => 0,
  95. 'show_count' => 0,
  96. 'hide_empty' => 1,
  97. 'selected' => 0,
  98. 'hierarchical' => 1,
  99. 'name' => 'city',
  100. 'id' => '',
  101. 'class' => 'search-cities-input drp-city select2',
  102. 'depth' => 1,
  103. 'tab_index' => 0,
  104. 'taxonomy' => $taxonomy_location_url );
  105. wp_dropdown_categories( $args );
  106. ?>
  107.  
  108. </div> <!-- country -->
  109.  
  110.  
  111.  
  112.  
  113.  
  114. <input type="submit" name="submit" value="Search" class="submit-button" />
  115.  
  116.  
  117.  
  118. </form>
  119.  
  120. </div>
Add Comment
Please, Sign In to add comment