Version Description
- 23-11-2020 =
- Fix - WooCommerce default pages not set properly after the theme demo import
- Fix - Elementor default kit introduced from version 3.0.0 not applied after the theme demo import
Download this release
Release Info
Developer | themegrilldev |
Plugin | ![]() |
Version | 1.6.8 |
Comparing to | |
See all releases |
Code changes from version 1.6.7 to 1.6.8
- includes/class-demo-importer.php +12 -9
- includes/class-themegrill-demo-importer.php +1 -1
- includes/functions-demo-importer.php +106 -46
- languages/themegrill-demo-importer.pot +10 -10
- readme.txt +5 -1
- themegrill-demo-importer.php +1 -1
includes/class-demo-importer.php
CHANGED
@@ -788,17 +788,20 @@ class TG_Demo_Importer {
|
|
788 |
* @return bool
|
789 |
*/
|
790 |
public function import_elementor_schemes( $demo_id, $demo_data ) {
|
791 |
-
if (
|
792 |
-
foreach ( $demo_data['elementor_schemes'] as $scheme_key => $scheme_value ) {
|
793 |
-
if ( ! in_array( $scheme_key, array( 'color', 'typography', 'color-picker' ) ) ) {
|
794 |
-
continue;
|
795 |
-
}
|
796 |
|
797 |
-
|
798 |
-
|
|
|
|
|
|
|
799 |
|
800 |
-
|
801 |
-
|
|
|
|
|
|
|
|
|
802 |
}
|
803 |
}
|
804 |
}
|
788 |
* @return bool
|
789 |
*/
|
790 |
public function import_elementor_schemes( $demo_id, $demo_data ) {
|
791 |
+
if ( version_compare( ELEMENTOR_VERSION, '3.0.0', '<=' ) ) {
|
|
|
|
|
|
|
|
|
792 |
|
793 |
+
if ( ! empty( $demo_data['elementor_schemes'] ) ) {
|
794 |
+
foreach ( $demo_data['elementor_schemes'] as $scheme_key => $scheme_value ) {
|
795 |
+
if ( ! in_array( $scheme_key, array( 'color', 'typography', 'color-picker' ) ) ) {
|
796 |
+
continue;
|
797 |
+
}
|
798 |
|
799 |
+
// Change scheme index to start from 1 instead.
|
800 |
+
$scheme_value = array_combine( range( 1, count( $scheme_value ) ), $scheme_value );
|
801 |
+
|
802 |
+
if ( ! empty( $scheme_value ) ) {
|
803 |
+
update_option( 'elementor_scheme_' . $scheme_key, $scheme_value );
|
804 |
+
}
|
805 |
}
|
806 |
}
|
807 |
}
|
includes/class-themegrill-demo-importer.php
CHANGED
@@ -20,7 +20,7 @@ final class ThemeGrill_Demo_Importer {
|
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
-
public $version = '1.6.
|
24 |
|
25 |
/**
|
26 |
* Theme single instance of this class.
|
20 |
*
|
21 |
* @var string
|
22 |
*/
|
23 |
+
public $version = '1.6.8';
|
24 |
|
25 |
/**
|
26 |
* Theme single instance of this class.
|
includes/functions-demo-importer.php
CHANGED
@@ -229,59 +229,27 @@ function tg_remove_theme_mods() {
|
|
229 |
/**
|
230 |
* After demo imported AJAX action.
|
231 |
*
|
232 |
-
* @see
|
233 |
*/
|
234 |
-
|
235 |
-
add_action( 'themegrill_ajax_demo_imported', 'tg_set_wc_pages' );
|
236 |
-
}
|
237 |
|
238 |
/**
|
239 |
-
* Set
|
240 |
-
*
|
241 |
-
* After importing demo data filter out duplicate WC pages and set them properly.
|
242 |
-
* Happens when the user run default woocommerce setup wizard during installation.
|
243 |
-
*
|
244 |
-
* Note: WC pages ID are stored in an option and slug are modified to remove any numbers.
|
245 |
-
*
|
246 |
-
* @param string $demo_id
|
247 |
*/
|
248 |
-
function
|
249 |
-
|
250 |
|
251 |
-
|
252 |
-
'
|
253 |
-
array(
|
254 |
-
'shop' => array(
|
255 |
-
'name' => 'shop',
|
256 |
-
'title' => 'Shop',
|
257 |
-
),
|
258 |
-
'cart' => array(
|
259 |
-
'name' => 'cart',
|
260 |
-
'title' => 'Cart',
|
261 |
-
),
|
262 |
-
'checkout' => array(
|
263 |
-
'name' => 'checkout',
|
264 |
-
'title' => 'Checkout',
|
265 |
-
),
|
266 |
-
'myaccount' => array(
|
267 |
-
'name' => 'my-account',
|
268 |
-
'title' => 'My Account',
|
269 |
-
),
|
270 |
-
)
|
271 |
-
);
|
272 |
-
|
273 |
-
// Set WC pages properly.
|
274 |
-
foreach ( $wc_pages as $key => $wc_page ) {
|
275 |
-
|
276 |
-
// Get the ID of every page with matching name or title.
|
277 |
-
$page_ids = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE (post_name = %s OR post_title = %s) AND post_type = 'page' AND post_status = 'publish'", $wc_page['name'], $wc_page['title'] ) );
|
278 |
|
279 |
if ( ! is_null( $page_ids ) ) {
|
|
|
280 |
$page_id = 0;
|
281 |
$delete_ids = array();
|
282 |
|
283 |
// Retrieve page with greater id and delete others.
|
284 |
if ( sizeof( $page_ids ) > 1 ) {
|
|
|
285 |
foreach ( $page_ids as $page ) {
|
286 |
if ( $page->ID > $page_id ) {
|
287 |
if ( $page_id ) {
|
@@ -302,21 +270,113 @@ function tg_set_wc_pages( $demo_id ) {
|
|
302 |
wp_delete_post( $delete_id, true );
|
303 |
}
|
304 |
|
305 |
-
// Update
|
306 |
if ( $page_id > 0 ) {
|
307 |
-
update_option( 'woocommerce_' . $key . '_page_id', $page_id );
|
308 |
wp_update_post(
|
309 |
array(
|
310 |
'ID' => $page_id,
|
311 |
-
'post_name' => sanitize_title(
|
312 |
)
|
313 |
);
|
|
|
314 |
}
|
315 |
}
|
316 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
|
322 |
/**
|
229 |
/**
|
230 |
* After demo imported AJAX action.
|
231 |
*
|
232 |
+
* @see tg_set_elementor_active_kit()
|
233 |
*/
|
234 |
+
add_action( 'themegrill_ajax_demo_imported', 'tg_set_elementor_active_kit' );
|
|
|
|
|
235 |
|
236 |
/**
|
237 |
+
* Set Elementor kit properly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
*/
|
239 |
+
function tg_set_elementor_active_kit() {
|
240 |
+
if ( version_compare( ELEMENTOR_VERSION, '3.0.0', '>=' ) ) {
|
241 |
|
242 |
+
global $wpdb;
|
243 |
+
$page_ids = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE (post_name = %s OR post_title = %s) AND post_type = 'elementor_library' AND post_status = 'publish'", 'default-kit', 'Default Kit' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
if ( ! is_null( $page_ids ) ) {
|
246 |
+
|
247 |
$page_id = 0;
|
248 |
$delete_ids = array();
|
249 |
|
250 |
// Retrieve page with greater id and delete others.
|
251 |
if ( sizeof( $page_ids ) > 1 ) {
|
252 |
+
|
253 |
foreach ( $page_ids as $page ) {
|
254 |
if ( $page->ID > $page_id ) {
|
255 |
if ( $page_id ) {
|
270 |
wp_delete_post( $delete_id, true );
|
271 |
}
|
272 |
|
273 |
+
// Update `elementor_active_kit` page.
|
274 |
if ( $page_id > 0 ) {
|
|
|
275 |
wp_update_post(
|
276 |
array(
|
277 |
'ID' => $page_id,
|
278 |
+
'post_name' => sanitize_title( 'Default Kit' ),
|
279 |
)
|
280 |
);
|
281 |
+
update_option( 'elementor_active_kit', $page_id );
|
282 |
}
|
283 |
}
|
284 |
}
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* After demo imported AJAX action.
|
289 |
+
*
|
290 |
+
* @see tg_set_wc_pages()
|
291 |
+
*/
|
292 |
+
add_action( 'themegrill_ajax_demo_imported', 'tg_set_wc_pages' );
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Set WC pages properly and disable setup wizard redirect.
|
296 |
+
*
|
297 |
+
* After importing demo data filter out duplicate WC pages and set them properly.
|
298 |
+
* Happens when the user run default woocommerce setup wizard during installation.
|
299 |
+
*
|
300 |
+
* Note: WC pages ID are stored in an option and slug are modified to remove any numbers.
|
301 |
+
*
|
302 |
+
* @param string $demo_id
|
303 |
+
*/
|
304 |
+
function tg_set_wc_pages( $demo_id ) {
|
305 |
+
if ( class_exists( 'WooCommerce' ) ) {
|
306 |
+
|
307 |
+
global $wpdb;
|
308 |
+
$wc_pages = apply_filters(
|
309 |
+
'themegrill_wc_' . $demo_id . '_pages',
|
310 |
+
array(
|
311 |
+
'shop' => array(
|
312 |
+
'name' => 'shop',
|
313 |
+
'title' => 'Shop',
|
314 |
+
),
|
315 |
+
'cart' => array(
|
316 |
+
'name' => 'cart',
|
317 |
+
'title' => 'Cart',
|
318 |
+
),
|
319 |
+
'checkout' => array(
|
320 |
+
'name' => 'checkout',
|
321 |
+
'title' => 'Checkout',
|
322 |
+
),
|
323 |
+
'myaccount' => array(
|
324 |
+
'name' => 'my-account',
|
325 |
+
'title' => 'My Account',
|
326 |
+
),
|
327 |
+
)
|
328 |
+
);
|
329 |
+
|
330 |
+
// Set WC pages properly.
|
331 |
+
foreach ( $wc_pages as $key => $wc_page ) {
|
332 |
+
|
333 |
+
// Get the ID of every page with matching name or title.
|
334 |
+
$page_ids = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE (post_name = %s OR post_title = %s) AND post_type = 'page' AND post_status = 'publish'", $wc_page['name'], $wc_page['title'] ) );
|
335 |
|
336 |
+
if ( ! is_null( $page_ids ) ) {
|
337 |
+
|
338 |
+
$page_id = 0;
|
339 |
+
$delete_ids = array();
|
340 |
+
|
341 |
+
// Retrieve page with greater id and delete others.
|
342 |
+
if ( sizeof( $page_ids ) > 1 ) {
|
343 |
+
|
344 |
+
foreach ( $page_ids as $page ) {
|
345 |
+
if ( $page->ID > $page_id ) {
|
346 |
+
if ( $page_id ) {
|
347 |
+
$delete_ids[] = $page_id;
|
348 |
+
}
|
349 |
+
|
350 |
+
$page_id = $page->ID;
|
351 |
+
} else {
|
352 |
+
$delete_ids[] = $page->ID;
|
353 |
+
}
|
354 |
+
}
|
355 |
+
} else {
|
356 |
+
$page_id = $page_ids[0]->ID;
|
357 |
+
}
|
358 |
+
|
359 |
+
// Delete posts.
|
360 |
+
foreach ( $delete_ids as $delete_id ) {
|
361 |
+
wp_delete_post( $delete_id, true );
|
362 |
+
}
|
363 |
+
|
364 |
+
// Update WC page.
|
365 |
+
if ( $page_id > 0 ) {
|
366 |
+
wp_update_post(
|
367 |
+
array(
|
368 |
+
'ID' => $page_id,
|
369 |
+
'post_name' => sanitize_title( $wc_page['name'] ),
|
370 |
+
)
|
371 |
+
);
|
372 |
+
update_option( 'woocommerce_' . $key . '_page_id', $page_id );
|
373 |
+
}
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
// We no longer need WC setup wizard redirect.
|
378 |
+
delete_transient( '_wc_activation_redirect' );
|
379 |
+
}
|
380 |
}
|
381 |
|
382 |
/**
|
languages/themegrill-demo-importer.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the GPLv3 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: ThemeGrill Demo Importer 1.6.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/themegrill-demo-importer\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2020-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: themegrill-demo-importer\n"
|
@@ -104,7 +104,7 @@ msgid "Deactivate"
|
|
104 |
msgstr ""
|
105 |
|
106 |
#: includes/admin/class-plugin-deactivate-notice.php:78
|
107 |
-
#: includes/class-demo-importer.php:
|
108 |
msgid "Action failed. Please refresh the page and retry."
|
109 |
msgstr ""
|
110 |
|
@@ -722,11 +722,11 @@ msgstr ""
|
|
722 |
msgid "The XML file dummy content is missing."
|
723 |
msgstr ""
|
724 |
|
725 |
-
#: includes/class-demo-importer.php:
|
726 |
msgid "The DAT file customizer data is missing."
|
727 |
msgstr ""
|
728 |
|
729 |
-
#: includes/class-demo-importer.php:
|
730 |
msgid "The WIE file widget content is missing."
|
731 |
msgstr ""
|
732 |
|
@@ -774,26 +774,26 @@ msgid "Sorry, you are not allowed to install plugins on this site."
|
|
774 |
msgstr ""
|
775 |
|
776 |
#. translators: %s: Number of plugins
|
777 |
-
#: includes/functions-demo-importer.php:
|
778 |
msgid "%s plugin successfully installed."
|
779 |
msgstr ""
|
780 |
|
781 |
#. translators: %s: Number of plugins
|
782 |
-
#: includes/functions-demo-importer.php:
|
783 |
msgid "%s plugins successfully installed."
|
784 |
msgstr ""
|
785 |
|
786 |
#. translators: %s: Number of failed installs
|
787 |
-
#: includes/functions-demo-importer.php:
|
788 |
msgid "%s install failed."
|
789 |
msgstr ""
|
790 |
|
791 |
#. translators: %s: Number of failed installs
|
792 |
-
#: includes/functions-demo-importer.php:
|
793 |
msgid "%s installs failed."
|
794 |
msgstr ""
|
795 |
|
796 |
-
#: includes/functions-demo-importer.php:
|
797 |
msgid "Show more details"
|
798 |
msgstr ""
|
799 |
|
2 |
# This file is distributed under the GPLv3 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: ThemeGrill Demo Importer 1.6.8\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/themegrill-demo-importer\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2020-11-23T06:32:34+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: themegrill-demo-importer\n"
|
104 |
msgstr ""
|
105 |
|
106 |
#: includes/admin/class-plugin-deactivate-notice.php:78
|
107 |
+
#: includes/class-demo-importer.php:1277
|
108 |
msgid "Action failed. Please refresh the page and retry."
|
109 |
msgstr ""
|
110 |
|
722 |
msgid "The XML file dummy content is missing."
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: includes/class-demo-importer.php:830
|
726 |
msgid "The DAT file customizer data is missing."
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: includes/class-demo-importer.php:855
|
730 |
msgid "The WIE file widget content is missing."
|
731 |
msgstr ""
|
732 |
|
774 |
msgstr ""
|
775 |
|
776 |
#. translators: %s: Number of plugins
|
777 |
+
#: includes/functions-demo-importer.php:411
|
778 |
msgid "%s plugin successfully installed."
|
779 |
msgstr ""
|
780 |
|
781 |
#. translators: %s: Number of plugins
|
782 |
+
#: includes/functions-demo-importer.php:418
|
783 |
msgid "%s plugins successfully installed."
|
784 |
msgstr ""
|
785 |
|
786 |
#. translators: %s: Number of failed installs
|
787 |
+
#: includes/functions-demo-importer.php:428
|
788 |
msgid "%s install failed."
|
789 |
msgstr ""
|
790 |
|
791 |
#. translators: %s: Number of failed installs
|
792 |
+
#: includes/functions-demo-importer.php:433
|
793 |
msgid "%s installs failed."
|
794 |
msgstr ""
|
795 |
|
796 |
+
#: includes/functions-demo-importer.php:436
|
797 |
msgid "Show more details"
|
798 |
msgstr ""
|
799 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: ThemeGrill, shivapoudel
|
|
3 |
Tags: themegrill, theme demos, demo, importer, one click import
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 5.5
|
6 |
-
Stable tag: 1.6.
|
7 |
License: GPLv3 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -72,6 +72,10 @@ Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/th
|
|
72 |
3. Finally, Import the Demo with just one click.
|
73 |
|
74 |
== Changelog ==
|
|
|
|
|
|
|
|
|
75 |
= 1.6.7 - 15-09-2020 =
|
76 |
* Tweak - Utilize `wp.i18n` for translation of strings for `wp.updates.l10n` deprecated since WordPress 5.5
|
77 |
|
3 |
Tags: themegrill, theme demos, demo, importer, one click import
|
4 |
Requires at least: 4.7
|
5 |
Tested up to: 5.5
|
6 |
+
Stable tag: 1.6.8
|
7 |
License: GPLv3 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
72 |
3. Finally, Import the Demo with just one click.
|
73 |
|
74 |
== Changelog ==
|
75 |
+
= 1.6.8 - 23-11-2020 =
|
76 |
+
* Fix - WooCommerce default pages not set properly after the theme demo import
|
77 |
+
* Fix - Elementor default kit introduced from version 3.0.0 not applied after the theme demo import
|
78 |
+
|
79 |
= 1.6.7 - 15-09-2020 =
|
80 |
* Tweak - Utilize `wp.i18n` for translation of strings for `wp.updates.l10n` deprecated since WordPress 5.5
|
81 |
|
themegrill-demo-importer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: ThemeGrill Demo Importer
|
4 |
* Plugin URI: https://themegrill.com/demo-importer/
|
5 |
* Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
|
6 |
-
* Version: 1.6.
|
7 |
* Author: ThemeGrill
|
8 |
* Author URI: https://themegrill.com
|
9 |
* License: GPLv3 or later
|
3 |
* Plugin Name: ThemeGrill Demo Importer
|
4 |
* Plugin URI: https://themegrill.com/demo-importer/
|
5 |
* Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
|
6 |
+
* Version: 1.6.8
|
7 |
* Author: ThemeGrill
|
8 |
* Author URI: https://themegrill.com
|
9 |
* License: GPLv3 or later
|