Import Settings into WordPress SEO by Yoast - Version 1.1.2

Version Description

  • Added focus keyword text input field
Download this release

Release Info

Developer WPAllImport
Plugin Icon 128x128 Import Settings into WordPress SEO by Yoast
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

Files changed (3) hide show
  1. README.md +2 -5
  2. readme.txt +4 -1
  3. yoast-addon.php +33 -23
README.md CHANGED
@@ -5,6 +5,7 @@
5
  | Name | Custom Field | Values |
6
  | ----------------------------------------| --------------------------------------------| ----------------------------------------------------------------------------- |
7
  | Focus Keyword | _yoast_wpseo_focuskw | Text string |
 
8
  | SEO Title | _yoast_wpseo_title | Text string |
9
  | Meta Description | _yoast_wpseo_metadesc | Text string |
10
  | Meta Robots Index | _yoast_wpseo_meta-robots-noindex | Blank for default, 1 for noindex, or 2 for index |
@@ -18,8 +19,4 @@
18
  | Facebook Description | _yoast_wpseo_opengraph | Text string |
19
  | Facebook Image | _yoast_wpseo_opengraph-image | URL to image |
20
  | Primary Category | _yoast_wpseo_primary_category | Primary Category ID |
21
- | Primary Category for Products | _yoast_wpseo_primary_product_cat | Primary WooCommerce Product Category ID |
22
- | Primary Category Add-On Field | _yoast_wpseo_primary_category_addon | Name or Slug of Primary Category |
23
- | Primary Category Update Option | _yoast_wpseo_primary_category_can_update | 1 (true) or empty |
24
- | Primary Product Category Update Option | _yoast_wpseo_primary_product_cat_can_update | 1 (true) or empty |
25
- | Primary Category Slug | _yoast_wpseo_addon_category_slug | The slug of the Primary Category |
5
  | Name | Custom Field | Values |
6
  | ----------------------------------------| --------------------------------------------| ----------------------------------------------------------------------------- |
7
  | Focus Keyword | _yoast_wpseo_focuskw | Text string |
8
+ | Focus Keyword Text Input | _yoast_wpseo_focuskw_text_input | Text string |
9
  | SEO Title | _yoast_wpseo_title | Text string |
10
  | Meta Description | _yoast_wpseo_metadesc | Text string |
11
  | Meta Robots Index | _yoast_wpseo_meta-robots-noindex | Blank for default, 1 for noindex, or 2 for index |
19
  | Facebook Description | _yoast_wpseo_opengraph | Text string |
20
  | Facebook Image | _yoast_wpseo_opengraph-image | URL to image |
21
  | Primary Category | _yoast_wpseo_primary_category | Primary Category ID |
22
+ | Primary Category for Products | _yoast_wpseo_primary_product_cat | Primary WooCommerce Product Category ID |
 
 
 
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ License: GPLv2 or later
5
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
6
  Requires at least: 4.1.0
7
  Tested up to: 4.5.2
8
- Stable tag: 1.1.1
9
 
10
  Easily import SEO settings from any XML or CSV file to Yoast WordPress SEO with the Yoast WordPress SEO Add-On for WP All Import.
11
 
@@ -66,6 +66,9 @@ The Yoast WordPress SEO Add-On will appear in the Step 3 of WP All Import.
66
 
67
  == Changelog ==
68
 
 
 
 
69
  = 1.1.1 =
70
  * Added primary category setting
71
 
5
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
6
  Requires at least: 4.1.0
7
  Tested up to: 4.5.2
8
+ Stable tag: 1.1.2
9
 
10
  Easily import SEO settings from any XML or CSV file to Yoast WordPress SEO with the Yoast WordPress SEO Add-On for WP All Import.
11
 
66
 
67
  == Changelog ==
68
 
69
+ = 1.1.2 =
70
+ * Added focus keyword text input field
71
+
72
  = 1.1.1 =
73
  * Added primary category setting
74
 
yoast-addon.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: WP All Import - Yoast WordPress SEO Add-On
5
  Plugin URI: http://www.wpallimport.com/
6
  Description: Import data into Yoast WordPress SEO with WP All Import.
7
- Version: 1.1.1
8
  Author: Soflyy
9
  */
10
 
@@ -142,7 +142,6 @@ function yoast_seo_addon_import( $post_id, $data, $import_options ) {
142
  '_yoast_wpseo_twitter-title',
143
  '_yoast_wpseo_twitter-description',
144
  '_yoast_wpseo_primary_category_addon'
145
-
146
  );
147
 
148
  // image fields
@@ -155,45 +154,53 @@ function yoast_seo_addon_import( $post_id, $data, $import_options ) {
155
 
156
  // update everything in fields arrays
157
  foreach ( $fields as $field ) {
 
158
 
159
- if ( $yoast_addon->can_update_meta( $field, $import_options ) ) {
160
 
161
- if ( in_array( $field, $image_fields ) ) {
162
 
163
- if ( $yoast_addon->can_update_image( $import_options ) ) {
164
 
165
- $id = $data[$field]['attachment_id'];
166
-
167
- $url = wp_get_attachment_url( $id );
168
 
169
- update_post_meta( $post_id, $field, $url );
170
 
171
- }
172
 
173
- } else {
174
 
175
- if ( $field == '_yoast_wpseo_primary_category_addon' ) {
176
 
177
- $title = $data[$field];
178
 
179
- $cat_slug = sanitize_title( $title ); // Get the slug for the Primary Category so we can match it later
 
 
 
 
180
 
181
- update_post_meta( $post_id, '_yoast_wpseo_addon_category_slug', $cat_slug );
182
 
183
- // Set post metas for regular categories and product categories so we know if we can update them after pmxi_saved_post hook fires.
184
 
185
- update_post_meta( $post_id, '_yoast_wpseo_primary_category_can_update', $yoast_addon->can_update_meta( '_yoast_wpseo_primary_category', $import_options ) );
186
 
187
- update_post_meta( $post_id, '_yoast_wpseo_primary_product_cat_can_update', $yoast_addon->can_update_meta( '_yoast_wpseo_primary_product_cat', $import_options ) );
 
188
 
189
- } else {
190
 
191
- update_post_meta( $post_id, $field, $data[$field] );
192
 
193
- }
194
- }
195
- }
 
196
  }
 
197
  // calculate _yoast_wpseo_linkdex
198
  if ( class_exists( 'WPSEO_Metabox' ) ) {
199
 
@@ -254,4 +261,7 @@ function yoast_addon_primary_category( $post_id ) {
254
  }
255
  }
256
  }
 
 
 
257
  }
4
  Plugin Name: WP All Import - Yoast WordPress SEO Add-On
5
  Plugin URI: http://www.wpallimport.com/
6
  Description: Import data into Yoast WordPress SEO with WP All Import.
7
+ Version: 1.1.2
8
  Author: Soflyy
9
  */
10
 
142
  '_yoast_wpseo_twitter-title',
143
  '_yoast_wpseo_twitter-description',
144
  '_yoast_wpseo_primary_category_addon'
 
145
  );
146
 
147
  // image fields
154
 
155
  // update everything in fields arrays
156
  foreach ( $fields as $field ) {
157
+ if ( $field == '_yoast_wpseo_primary_category_addon' ) {
158
 
159
+ $title = $data[$field];
160
 
161
+ $cat_slug = sanitize_title( $title ); // Get the slug for the Primary Category so we can match it later
162
 
163
+ update_post_meta( $post_id, '_yoast_wpseo_addon_category_slug', $cat_slug );
164
 
165
+ // Set post metas for regular categories and product categories so we know if we can update them after pmxi_saved_post hook fires.
166
+
167
+ update_post_meta( $post_id, '_yoast_wpseo_primary_category_can_update', $yoast_addon->can_update_meta( '_yoast_wpseo_primary_category', $import_options ) );
168
 
169
+ update_post_meta( $post_id, '_yoast_wpseo_primary_product_cat_can_update', $yoast_addon->can_update_meta( '_yoast_wpseo_primary_product_cat', $import_options ) );
170
 
171
+ } else {
172
 
173
+ if ( $yoast_addon->can_update_meta( $field, $import_options ) ) {
174
 
175
+ if ( in_array( $field, $image_fields ) ) {
176
 
177
+ if ( $yoast_addon->can_update_image( $import_options ) ) {
178
 
179
+ $id = $data[$field]['attachment_id'];
180
+
181
+ $url = wp_get_attachment_url( $id );
182
+
183
+ update_post_meta( $post_id, $field, $url );
184
 
185
+ }
186
 
187
+ } else {
188
 
189
+ if ( $field == '_yoast_wpseo_focuskw' ) {
190
 
191
+ update_post_meta( $post_id, $field, $data[$field] );
192
+ update_post_meta( $post_id, '_yoast_wpseo_focuskw_text_input', $data[$field] );
193
 
194
+ } else {
195
 
196
+ update_post_meta( $post_id, $field, $data[$field] );
197
 
198
+ }
199
+ }
200
+ }
201
+ }
202
  }
203
+
204
  // calculate _yoast_wpseo_linkdex
205
  if ( class_exists( 'WPSEO_Metabox' ) ) {
206
 
261
  }
262
  }
263
  }
264
+ delete_post_meta( $post_id, '_yoast_wpseo_primary_category_can_update' );
265
+ delete_post_meta( $post_id, '_yoast_wpseo_primary_product_cat_can_update' );
266
+ delete_post_meta( $post_id, '_yoast_wpseo_addon_category_slug' );
267
  }