WP Store Locator - Version 2.2.19

Version Description

Download this release

Release Info

Developer tijmensmit
Plugin Icon 128x128 WP Store Locator
Version 2.2.19
Comparing to
See all releases

Code changes from version 2.2.18 to 2.2.19

Files changed (3) hide show
  1. inc/class-post-types.php +30 -11
  2. readme.txt +4 -1
  3. wp-store-locator.php +2 -2
inc/class-post-types.php CHANGED
@@ -11,11 +11,12 @@ if ( !defined( 'ABSPATH' ) ) exit;
11
  if ( !class_exists( 'WPSL_Post_Types' ) ) {
12
 
13
  class WPSL_Post_Types {
14
-
15
  /**
16
  * Constructor
17
  */
18
  public function __construct() {
 
19
  add_action( 'init', array( $this, 'register_post_types' ), 10, 1 );
20
  add_action( 'init', array( $this, 'register_taxonomies' ), 10, 1 );
21
  add_action( 'manage_wpsl_stores_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
@@ -24,8 +25,28 @@ if ( !class_exists( 'WPSL_Post_Types' ) ) {
24
  add_filter( 'manage_edit-wpsl_stores_columns', array( $this, 'edit_columns' ) );
25
  add_filter( 'manage_edit-wpsl_stores_sortable_columns', array( $this, 'sortable_columns' ) );
26
  add_filter( 'request', array( $this, 'sort_columns' ) );
27
- }
28
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  /**
30
  * Register the WPSL post type.
31
  *
@@ -34,8 +55,8 @@ if ( !class_exists( 'WPSL_Post_Types' ) ) {
34
  */
35
  public function register_post_types() {
36
 
37
- global $wpsl_settings, $wp_version;
38
-
39
  // Enable permalinks for the post type?
40
  if ( isset( $wpsl_settings['permalinks'] ) && $wpsl_settings['permalinks'] ) {
41
  $public = true;
@@ -47,9 +68,6 @@ if ( !class_exists( 'WPSL_Post_Types' ) ) {
47
  $rewrite = false;
48
  }
49
 
50
- // For WP 5.x set it to true to enable the Gutenberg editor.
51
- $show_in_rest = ( floatval( $wp_version ) >= 5 ) ? true : false;
52
-
53
  // The labels for the wpsl_stores post type.
54
  $labels = apply_filters( 'wpsl_post_type_labels', array(
55
  'name' => __( 'Store Locator', 'wpsl' ),
@@ -78,10 +96,10 @@ if ( !class_exists( 'WPSL_Post_Types' ) ) {
78
  'rewrite' => $rewrite,
79
  'query_var' => 'wpsl_stores',
80
  'supports' => array( 'title', 'editor', 'author', 'excerpt', 'revisions', 'thumbnail' ),
81
- 'show_in_rest' => $show_in_rest
82
  )
83
  );
84
-
85
  register_post_type( 'wpsl_stores', $args );
86
  }
87
 
@@ -126,7 +144,8 @@ if ( !class_exists( 'WPSL_Post_Types' ) ) {
126
  'show_admin_column' => true,
127
  'update_count_callback' => '_update_post_term_count',
128
  'query_var' => true,
129
- 'rewrite' => $rewrite
 
130
  )
131
  );
132
 
11
  if ( !class_exists( 'WPSL_Post_Types' ) ) {
12
 
13
  class WPSL_Post_Types {
14
+
15
  /**
16
  * Constructor
17
  */
18
  public function __construct() {
19
+ add_action( 'init', array( $this, 'maybe_show_in_rest' ) );
20
  add_action( 'init', array( $this, 'register_post_types' ), 10, 1 );
21
  add_action( 'init', array( $this, 'register_taxonomies' ), 10, 1 );
22
  add_action( 'manage_wpsl_stores_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
25
  add_filter( 'manage_edit-wpsl_stores_columns', array( $this, 'edit_columns' ) );
26
  add_filter( 'manage_edit-wpsl_stores_sortable_columns', array( $this, 'sortable_columns' ) );
27
  add_filter( 'request', array( $this, 'sort_columns' ) );
28
+ }
29
+
30
+ /**
31
+ * Check if we need to set 'show_in_rest' to true/false,
32
+ * and thereby enabling the REST API.
33
+ *
34
+ * This needs to be set to true for
35
+ * Gutenberg to be enabled.
36
+ *
37
+ * Full REST API support will come in the 3.0 update.
38
+ *
39
+ * @since 2.2.19
40
+ * @return bool
41
+ */
42
+ public function maybe_show_in_rest() {
43
+
44
+ global $wp_version;
45
+
46
+ return ( version_compare( $wp_version, '5', '>=' ) ) ? true : false;
47
+ }
48
+
49
+
50
  /**
51
  * Register the WPSL post type.
52
  *
55
  */
56
  public function register_post_types() {
57
 
58
+ global $wpsl_settings;
59
+
60
  // Enable permalinks for the post type?
61
  if ( isset( $wpsl_settings['permalinks'] ) && $wpsl_settings['permalinks'] ) {
62
  $public = true;
68
  $rewrite = false;
69
  }
70
 
 
 
 
71
  // The labels for the wpsl_stores post type.
72
  $labels = apply_filters( 'wpsl_post_type_labels', array(
73
  'name' => __( 'Store Locator', 'wpsl' ),
96
  'rewrite' => $rewrite,
97
  'query_var' => 'wpsl_stores',
98
  'supports' => array( 'title', 'editor', 'author', 'excerpt', 'revisions', 'thumbnail' ),
99
+ 'show_in_rest' => $this->maybe_show_in_rest()
100
  )
101
  );
102
+
103
  register_post_type( 'wpsl_stores', $args );
104
  }
105
 
144
  'show_admin_column' => true,
145
  'update_count_callback' => '_update_post_term_count',
146
  'query_var' => true,
147
+ 'rewrite' => $rewrite,
148
+ 'show_in_rest' => $this->maybe_show_in_rest()
149
  )
150
  );
151
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.me/tijmensmit
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
  Tested up to: 5.0.0
8
- Stable tag: 2.2.18
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
@@ -126,6 +126,9 @@ If you find a plugin or theme that causes a conflict, please report it on the [s
126
 
127
  == Changelog ==
128
 
 
 
 
129
  = 2.2.18, December 2, 2018 =
130
  * New: Added role="presentation" to the hours table.
131
  * New: Added a [wpsl_strip_content_shortcode](https://wpstorelocator.co/document/wpsl_strip_content_shortcode/) filter to optionally prevent strip_shortcodes from running on the post content data shown in the search results.
5
  Tags: google maps, store locator, business locations, geocoding, stores, geo, zipcode locator, dealer locater, geocode, gmaps, google map, google map plugin, location finder, map tools, shop locator, wp google map
6
  Requires at least: 3.7
7
  Tested up to: 5.0.0
8
+ Stable tag: 2.2.19
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
11
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.2.19, December 6, 2018 =
130
+ * Fixed: Not being able to assign locations to a category when [Gutenberg](https://wordpress.org/gutenberg/) is used.
131
+
132
  = 2.2.18, December 2, 2018 =
133
  * New: Added role="presentation" to the hours table.
134
  * New: Added a [wpsl_strip_content_shortcode](https://wpstorelocator.co/document/wpsl_strip_content_shortcode/) filter to optionally prevent strip_shortcodes from running on the post content data shown in the search results.
wp-store-locator.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Store Locator
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
- Version: 2.2.18
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
@@ -61,7 +61,7 @@ if ( !class_exists( 'WP_Store_locator' ) ) {
61
  public function define_constants() {
62
 
63
  if ( !defined( 'WPSL_VERSION_NUM' ) )
64
- define( 'WPSL_VERSION_NUM', '2.2.18' );
65
 
66
  if ( !defined( 'WPSL_URL' ) )
67
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
4
  Description: An easy to use location management system that enables users to search for nearby physical stores
5
  Author: Tijmen Smit
6
  Author URI: https://wpstorelocator.co/
7
+ Version: 2.2.19
8
  Text Domain: wpsl
9
  Domain Path: /languages/
10
  License: GPL v3
61
  public function define_constants() {
62
 
63
  if ( !defined( 'WPSL_VERSION_NUM' ) )
64
+ define( 'WPSL_VERSION_NUM', '2.2.19' );
65
 
66
  if ( !defined( 'WPSL_URL' ) )
67
  define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );