| 1 |
#!/bin/bash |
| 2 |
set -eox pipefail |
| 3 |
|
| 4 |
wp plugin install wordpress-importer --activate |
| 5 |
wp plugin activate elementor |
| 6 |
wp plugin activate woocommerce |
| 7 |
|
| 8 |
# Conditionally activate themes based on availability |
| 9 |
if wp theme list --field=name | grep -q "hello-commerce"; then |
| 10 |
echo "Activating Hello Commerce theme" |
| 11 |
wp theme activate hello-commerce |
| 12 |
elif wp theme list --field=name | grep -q "hello-biz"; then |
| 13 |
echo "Activating Hello Biz theme" |
| 14 |
wp theme activate hello-biz |
| 15 |
else |
| 16 |
echo "Neither Hello Commerce nor Hello Biz theme found - using default theme" |
| 17 |
fi |
| 18 |
|
| 19 |
wp plugin activate hello-plus |
| 20 |
|
| 21 |
# Conditionally handle Elementor Pro |
| 22 |
if wp plugin list --field=name | grep -q "elementor-pro"; then |
| 23 |
echo "Elementor Pro found - deactivating for setup" |
| 24 |
wp plugin deactivate elementor-pro |
| 25 |
else |
| 26 |
echo "Elementor Pro not installed - skipping deactivation" |
| 27 |
fi |
| 28 |
|
| 29 |
WP_CLI_CONFIG_PATH=hello-plus-config/wp-cli.yml wp rewrite structure '/%postname%/' --hard |
| 30 |
|
| 31 |
# Remove the Guttenberg welcome guide popup |
| 32 |
wp user meta add admin wp_persisted_preferences 'a:2:{s:14:\"core/edit-post\";a:2:{b:1;s:12:\"welcomeGuide\";b:0;}}' |
| 33 |
|
| 34 |
# Reset editor counter to avoid auto trigger of the checklist popup when entering the editor for the 2nd time |
| 35 |
wp option update e_editor_counter 10 |
| 36 |
wp option update elementor_checklist '{"last_opened_timestamp":null,"first_closed_checklist_in_editor":true,"is_popup_minimized":false,"steps":[],"should_open_in_editor":false,"editor_visit_count":10}' |
| 37 |
|
| 38 |
wp option set elementor_onboarded true |
| 39 |
|
| 40 |
# Add user meta so the announcement popup will not be displayed - ED-9723 |
| 41 |
for id in $(wp user list --field=ID) |
| 42 |
do wp user meta add "$id" "announcements_user_counter" 999 |
| 43 |
wp user meta add "$id" "elementor_onboarded" "a:1:{s:27:\"ai-get-started-announcement\";b:1;}" |
| 44 |
done |
| 45 |
|
| 46 |
wp cache flush |
| 47 |
wp rewrite flush --hard |
| 48 |
|
| 49 |
# Flush Elementor CSS if available |
| 50 |
if wp help elementor >/dev/null 2>&1; then |
| 51 |
wp elementor flush-css || echo "Warning: elementor flush-css failed, continuing..." |
| 52 |
else |
| 53 |
echo "Elementor commands not available yet - skipping CSS flush" |
| 54 |
fi |
| 55 |
|
| 56 |
# Install WooCommerce pages if WooCommerce is active |
| 57 |
if wp plugin is-active woocommerce; then |
| 58 |
echo "WooCommerce is active - installing pages" |
| 59 |
wp wc tool run install_pages --user=admin |
| 60 |
else |
| 61 |
echo "WooCommerce not active - skipping page installation" |
| 62 |
fi |
| 63 |
|
| 64 |
# Import sample data if file exists |
| 65 |
if [ -f "./wp-content/plugins/hello-plus/tests/playwright/sample-data/sample_products_with_acf_meta.xml" ]; then |
| 66 |
echo "Importing sample data" |
| 67 |
wp import ./wp-content/plugins/hello-plus/tests/playwright/sample-data/sample_products_with_acf_meta.xml --authors=skip --quiet --allow-root |
| 68 |
else |
| 69 |
echo "Sample data file not found - skipping import" |
| 70 |
fi |
| 71 |
|
| 72 |
# Import Hello Plus footer data if file exists |
| 73 |
if [ -f "./wp-content/plugins/hello-plus/tests/playwright/sample-data/hello-plus-footer.xml" ]; then |
| 74 |
echo "Importing Hello Plus footer data" |
| 75 |
wp import ./wp-content/plugins/hello-plus/tests/playwright/sample-data/hello-plus-footer.xml --authors=skip --quiet --allow-root |
| 76 |
else |
| 77 |
echo "Hello Plus footer data file not found - skipping import" |
| 78 |
fi |
| 79 |
|