Regions for WP Job Manager - Version 1.7.3

Version Description

Download this release

Release Info

Developer adampickering
Plugin Icon wp plugin Regions for WP Job Manager
Version 1.7.3
Comparing to
See all releases

Code changes from version 1.7.2 to 1.7.3

Files changed (3) hide show
  1. assets/js/main.js +6 -4
  2. readme.txt +7 -2
  3. wp-job-manager-locations.php +11 -10
assets/js/main.js CHANGED
@@ -5,7 +5,6 @@
5
  cache: {
6
  $document: $(document),
7
  $window: $(window),
8
- $search_jobs: $( '.search_jobs, .job_search_form' )
9
  },
10
 
11
  init: function() {
@@ -16,6 +15,8 @@
16
  var self = this;
17
 
18
  this.cache.$document.on( 'ready', function() {
 
 
19
  self.addSubmission();
20
  self.addRegions();
21
  self.updateResults();
@@ -28,11 +29,11 @@
28
  },
29
 
30
  addRegions: function() {
31
- this.cache.$search_jobs.each(function(i, el) {
32
  $(this).find( '.search_region' ).chosen();
33
  });
34
 
35
- this.cache.$search_jobs.each(function(i, el) {
36
  var location = $(this).find( '.search_location' );
37
  location.html( '' );
38
  location.removeClass( 'search_location' ).addClass( 'search_region' );
@@ -49,7 +50,7 @@
49
  },
50
 
51
  updateResults: function() {
52
- this.cache.$search_jobs.each(function(i, el) {
53
  var region = $(this).find( '.search_region' );
54
 
55
  region.on( 'change', function() {
@@ -72,3 +73,4 @@
72
  jobRegions.init();
73
 
74
  })(jQuery);
 
5
  cache: {
6
  $document: $(document),
7
  $window: $(window),
 
8
  },
9
 
10
  init: function() {
15
  var self = this;
16
 
17
  this.cache.$document.on( 'ready', function() {
18
+ self.$forms = $( '.search_jobs, .job_search_form' );
19
+
20
  self.addSubmission();
21
  self.addRegions();
22
  self.updateResults();
29
  },
30
 
31
  addRegions: function() {
32
+ this.$forms.each(function(i, el) {
33
  $(this).find( '.search_region' ).chosen();
34
  });
35
 
36
+ this.$forms.each(function(i, el) {
37
  var location = $(this).find( '.search_location' );
38
  location.html( '' );
39
  location.removeClass( 'search_location' ).addClass( 'search_region' );
50
  },
51
 
52
  updateResults: function() {
53
+ this.$forms.each(function(i, el) {
54
  var region = $(this).find( '.search_region' );
55
 
56
  region.on( 'change', function() {
73
  jobRegions.init();
74
 
75
  })(jQuery);
76
+
readme.txt CHANGED
@@ -6,8 +6,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=contact@
6
  Contributors: Astoundify
7
  Tags: job, job listing, job region
8
  Requires at least: 4.1
9
- Tested up to: 4.1.1
10
- Stable Tag: 1.7.2
11
  License: GPLv3
12
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
 
@@ -32,6 +32,11 @@ Astoundify has released two themes that are fully integrated with the WP Job Man
32
 
33
  == Changelog ==
34
 
 
 
 
 
 
35
  = 1.7.2: March 17, 2015 =
36
 
37
  * Fix: Properly place the standard <select> dropdown for mobile devices.
6
  Contributors: Astoundify
7
  Tags: job, job listing, job region
8
  Requires at least: 4.1
9
+ Tested up to: 4.2.1
10
+ Stable Tag: 1.7.3
11
  License: GPLv3
12
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
13
 
32
 
33
  == Changelog ==
34
 
35
+ = 1.7.3: April 1, 2015 =
36
+
37
+ * Fix: Make sure the regions dropdown can always replace the location input.
38
+ * Fix: Compatibility with WP Job Manager - Alerts.
39
+
40
  = 1.7.2: March 17, 2015 =
41
 
42
  * Fix: Properly place the standard <select> dropdown for mobile devices.
wp-job-manager-locations.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Create predefined regions/locations that job submissions can associate themselves with.
6
  * Author: Astoundify
7
  * Author URI: http://astoundify.com
8
- * Version: 1.7.2
9
  * Text Domain: wp-job-manager-locations
10
  */
11
 
@@ -160,18 +160,19 @@ class Astoundify_Job_Manager_Regions {
160
  'operator' => 'IN'
161
  );
162
 
163
- } elseif( isset( $_GET['alert_id'] ) ) { // WPJM Alerts support
164
 
165
- $regions = wp_get_post_terms( $_GET['alert_id'], 'job_listing_region', array( 'fields' => 'ids' ) );
166
- if ( ! empty( $regions ) ) {
167
- $args[ 'tax_query' ][] = array(
168
- 'taxonomy' => 'job_listing_region',
169
- 'field' => 'id',
170
- 'terms' => $regions,
171
- 'operator' => 'IN'
172
- );
173
  }
174
 
 
 
 
 
 
 
 
175
  }
176
 
177
  return $args;
5
  * Description: Create predefined regions/locations that job submissions can associate themselves with.
6
  * Author: Astoundify
7
  * Author URI: http://astoundify.com
8
+ * Version: 1.7.3
9
  * Text Domain: wp-job-manager-locations
10
  */
11
 
160
  'operator' => 'IN'
161
  );
162
 
163
+ } elseif( isset( $args['search_region'] ) ) { // WPJM Alerts support
164
 
165
+ if ( is_int( $args['search_region'] ) ) {
166
+ $region = array( $args['search_region'] );
 
 
 
 
 
 
167
  }
168
 
169
+ $args[ 'tax_query' ][] = array(
170
+ 'taxonomy' => 'job_listing_region',
171
+ 'field' => 'id',
172
+ 'terms' => $region,
173
+ 'operator' => 'IN'
174
+ );
175
+
176
  }
177
 
178
  return $args;