Template Kit – Import - Version 1.0.2

Version Description

  • 2020-03-24 =
  • Fix importing Elementor display conditions
Download this release

Release Info

Developer Brad Davis
Plugin Icon 128x128 Template Kit – Import
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

inc/class-builder-elementor.php CHANGED
@@ -72,6 +72,7 @@ class Builder_Elementor extends Builder {
72
  // Found the template to import from the manifest file.
73
  $template_kit_folder_name = $this->get_template_kit_temporary_folder();
74
  $template_json_file = $template_kit_folder_name . $json_file_path;
 
75
  $source = \Elementor\Plugin::$instance->templates_manager->get_source( 'local' );
76
  $result = $source->import_template( basename( $template_json_file ), $template_json_file );
77
 
@@ -82,8 +83,14 @@ class Builder_Elementor extends Builder {
82
  if ( $result[0] && $result[0]['template_id'] ) {
83
  $imported_template_id = $result[0]['template_id'];
84
  $this->record_import_event( $template_index, $imported_template_id );
85
- // Set it to canvas for friendly display:
86
- update_post_meta( $imported_template_id, '_wp_page_template', 'elementor_canvas' );
 
 
 
 
 
 
87
  // Record some metadata so we can link back to kit from imported template:
88
  update_post_meta( $imported_template_id, 'envato_tk_source_kit', $this->kit_id );
89
  update_post_meta( $imported_template_id, 'envato_tk_source_index', $template_index );
72
  // Found the template to import from the manifest file.
73
  $template_kit_folder_name = $this->get_template_kit_temporary_folder();
74
  $template_json_file = $template_kit_folder_name . $json_file_path;
75
+ $local_json_data = json_decode( file_get_contents( $template_json_file ), true );
76
  $source = \Elementor\Plugin::$instance->templates_manager->get_source( 'local' );
77
  $result = $source->import_template( basename( $template_json_file ), $template_json_file );
78
 
83
  if ( $result[0] && $result[0]['template_id'] ) {
84
  $imported_template_id = $result[0]['template_id'];
85
  $this->record_import_event( $template_index, $imported_template_id );
86
+ // Check if we've got any display conditions to import:
87
+ if ( $local_json_data['metadata'] && ! empty( $local_json_data['metadata']['elementor_pro_conditions'] ) ) {
88
+ update_post_meta( $imported_template_id, '_elementor_conditions', $local_json_data['metadata']['elementor_pro_conditions'] );
89
+ }
90
+ if ( $local_json_data['metadata'] && ! empty( $local_json_data['metadata']['wp_page_template'] ) ) {
91
+ // If there is a page template set we keep it the same here
92
+ update_post_meta( $imported_template_id, '_wp_page_template', $local_json_data['metadata']['wp_page_template'] );
93
+ }
94
  // Record some metadata so we can link back to kit from imported template:
95
  update_post_meta( $imported_template_id, 'envato_tk_source_kit', $this->kit_id );
96
  update_post_meta( $imported_template_id, 'envato_tk_source_index', $template_index );
languages/template-kit-import.pot CHANGED
@@ -34,7 +34,7 @@ msgstr ""
34
  msgid "Something went wrong."
35
  msgstr ""
36
 
37
- #: inc/class-builder-elementor.php:102
38
  msgid "Import into Elementor Library"
39
  msgstr ""
40
 
34
  msgid "Something went wrong."
35
  msgstr ""
36
 
37
+ #: inc/class-builder-elementor.php:109
38
  msgid "Import into Elementor Library"
39
  msgstr ""
40
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: envato
3
  Tags: elementor, template, templates
4
  Requires at least: 5.3
5
- Tested up to: 5.3.2
6
  Requires PHP: 5.6
7
- Stable tag: 1.0.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -36,6 +36,9 @@ Create your own "Template Kit" for others with the "[Template Kit Export](https:
36
 
37
  == Changelog ==
38
 
 
 
 
39
  = 1.0.1 - 2020-02-13 =
40
  * Support for Elementor 2.9.0
41
  * Support for Elementor Global Theme Styles
2
  Contributors: envato
3
  Tags: elementor, template, templates
4
  Requires at least: 5.3
5
+ Tested up to: 5.4
6
  Requires PHP: 5.6
7
+ Stable tag: 1.0.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.0.2 - 2020-03-24 =
40
+ * Fix importing Elementor display conditions
41
+
42
  = 1.0.1 - 2020-02-13 =
43
  * Support for Elementor 2.9.0
44
  * Support for Elementor Global Theme Styles
template-kit-import.php CHANGED
@@ -4,7 +4,7 @@
4
  * Description: Import Template Kits to WordPress
5
  * Author: Envato
6
  * Author URI: https://envato.com
7
- * Version: 1.0.1
8
  * License: GPLv3 or later
9
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  *
@@ -28,7 +28,7 @@ if ( ! defined( 'ABSPATH' ) ) {
28
  }
29
 
30
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_SLUG', 'template-kit-import' );
31
- define( 'ENVATO_TEMPLATE_KIT_IMPORT_VER', '1.0.1' );
32
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_FILE', __FILE__ );
33
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_DIR', plugin_dir_path( ENVATO_TEMPLATE_KIT_IMPORT_FILE ) );
34
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_URI', plugins_url( '/', ENVATO_TEMPLATE_KIT_IMPORT_FILE ) );
4
  * Description: Import Template Kits to WordPress
5
  * Author: Envato
6
  * Author URI: https://envato.com
7
+ * Version: 1.0.2
8
  * License: GPLv3 or later
9
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  *
28
  }
29
 
30
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_SLUG', 'template-kit-import' );
31
+ define( 'ENVATO_TEMPLATE_KIT_IMPORT_VER', '1.0.2' );
32
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_FILE', __FILE__ );
33
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_DIR', plugin_dir_path( ENVATO_TEMPLATE_KIT_IMPORT_FILE ) );
34
  define( 'ENVATO_TEMPLATE_KIT_IMPORT_URI', plugins_url( '/', ENVATO_TEMPLATE_KIT_IMPORT_FILE ) );