Advertisement
Guest User

search.php

a guest
Apr 23rd, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.05 KB | None | 0 0
  1. <?php if (isset($_GET['wqsfsubmit']) && $_GET['wqsfsubmit'] == 'Search' && $_GET[formid] =='673' ) : get_template_part('search-resume'); return; endif; ?>
  2.  
  3. <?php
  4.     $location = '';
  5.     if ( isset($_GET['location']) ){
  6.         $location = wp_strip_all_tags($_GET['location']);
  7.         $location = urldecode(utf8_uri_encode( trim($location) ));
  8.     }
  9. ?>
  10.  
  11. <?php get_header('search'); ?>
  12.    
  13. <?php do_action('jobs_will_display'); ?>
  14.  
  15.     <div class="section">
  16.  
  17.         <?php
  18.         // Global so we can pass it on to the filter-process.php file
  19.         global $find_posts_in, $search_result_ids, $wp_query, $query_string;
  20.  
  21.         $term_heading = '';
  22.         $location_heading = '';
  23.  
  24.         $search = get_search_query();
  25.         $radius = isset( $_GET['radius'] ) ? absint( $_GET['radius'] ) : 0;
  26.         if ( !$radius )
  27.             $radius = 50;
  28.  
  29.         if ($search) :
  30.             $search_result_ids[] = 0;
  31.  
  32.             if ($wp_query->posts) foreach ($wp_query->posts as $p) : $search_result_ids[] = $p->ID.''; endforeach;
  33.  
  34.             $term_heading = __('Searching for ',APP_TD).'&ldquo;'.$search.'&rdquo; ';
  35.         endif;
  36.  
  37.         if ($location) :
  38.             // Get address from post data
  39.             $address_array = '';
  40.            
  41.             if (isset($_REQUEST['latitude']) && $_REQUEST['latitude'] && $_REQUEST['longitude'] && $_REQUEST['full_address']) :
  42.                 $address_array = array(
  43.                     'north_east_lng'    => trim(stripslashes( $_REQUEST['north_east_lng'] )),
  44.                     'south_west_lng'    => trim(stripslashes( $_REQUEST['south_west_lng'] )),
  45.                     'north_east_lat'    => trim(stripslashes( $_REQUEST['north_east_lat'] )),
  46.                     'south_west_lat'    => trim(stripslashes( $_REQUEST['south_west_lat'] )),
  47.                     'longitude'     => trim(stripslashes( $_REQUEST['longitude'] )),
  48.                     'latitude'      => trim(stripslashes( $_REQUEST['latitude'] )),
  49.                     'full_address'  => trim(stripslashes( $_REQUEST['full_address'] ))
  50.                 );
  51.             endif;
  52.  
  53.             // Do radial search
  54.             $radial_result = jr_radial_search($location, $radius, $address_array);
  55.             if (is_array($radial_result)) :
  56.                 if ($radial_result['address']) $location = $radial_result['address'];
  57.                 $find_posts_in = $radial_result['posts'];
  58.             endif;
  59.            
  60.             if ( get_option('jr_distance_unit') == 'km' )
  61.                 $format = __( 'Jobs within %s kilometers of %s', APP_TD );
  62.             else
  63.                 $format = __( 'Jobs within %s miles of %s', APP_TD );
  64.  
  65.             $location_heading = sprintf( $format, $radius, $location );
  66.        
  67.         endif;
  68.  
  69.         if ( !$term_heading && !$location_heading )
  70.             $term_heading = __('Search Results', APP_TD);
  71.         ?>
  72.  
  73.         <h1 class="pagetitle"><?php echo $term_heading.$location_heading; ?> <?php if ( $paged>1 ) : ?>(<?php _e('page',APP_TD); ?> <?php echo number_format_i18n( $paged ); ?>)<?php endif; ?></h1>
  74.  
  75.         <?php
  76.         $main_wp_query = $wp_query;
  77.  
  78.         $args = jr_filter_form();
  79.         //query_posts($args);
  80.         ?>
  81.  
  82.         <?php appthemes_load_template( 'loop-job.php', array( 'main_wp_query' => $main_wp_query ) ); ?>
  83.  
  84.         <?php jr_paging(); ?>
  85.  
  86.         <div class="clear"></div>
  87.  
  88.     </div><!-- end section -->
  89.    
  90.     <?php do_action('after_search_results'); ?>
  91.  
  92.     <div class="clear"></div>
  93.  
  94. </div><!-- end main content -->
  95.  
  96. <?php if (get_option('jr_show_sidebar')!=='no') get_sidebar(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement