# ==========================================
# CONFIG — edit these before running
# ==========================================
SITE_URL="https://frozenmotorsports.com"
SITE_TITLE="Frozen Motorsports"
SITE_TAGLINE="Off-Road. Overland. Filmed."
ADMIN_USER="chris"
ADMIN_EMAIL="chris@frozenmotorsports.com"
ADMIN_PASSWORD=""   # Leave blank to be prompted, or set here
BUSINESS_ADDRESS_CITY="Huntington"
BUSINESS_ADDRESS_STATE="IN"
BUSINESS_ADDRESS_COUNTRY="US"
CURRENCY="USD"
 
# Theme to activate (must be uploaded to wp-content/themes/ first)
THEME_SLUG="frozen-motorsports"
 
# ==========================================
# Helper functions
# ==========================================
log() { echo -e "\033[1;36m[FZN]\033[0m $*"; }
ok()  { echo -e "\033[1;32m [✓]\033[0m $*"; }
warn(){ echo -e "\033[1;33m [!]\033[0m $*"; }
die() { echo -e "\033[1;31m [✗]\033[0m $*" >&2; exit 1; }
 
# ==========================================
# Preflight checks
# ==========================================
log "Preflight checks..."
 
command -v wp >/dev/null || die "WP-CLI not found. Install it or run commands manually via WP admin."
wp core is-installed --quiet || die "WordPress is not installed yet. Run 'wp core install' first or install via your host's installer."
 
ok "WP-CLI found: $(wp --version)"
ok "WordPress installed: $(wp core version)"
 
# ==========================================
# Core settings
# ==========================================
log "Configuring core settings..."
 
wp option update blogname "$SITE_TITLE"
wp option update blogdescription "$SITE_TAGLINE"
wp option update admin_email "$ADMIN_EMAIL"
wp option update siteurl "$SITE_URL"
wp option update home "$SITE_URL"
wp option update timezone_string "America/Indiana/Indianapolis"
wp option update date_format "F j, Y"
wp option update time_format "g:i a"
wp option update start_of_week 1
 
# Permalinks: post name (pretty URLs)
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
 
ok "Core settings configured"
 
# ==========================================
# Clean up default content
# ==========================================
log "Removing default WordPress clutter..."
 
# Delete "Hello world!" post
wp post delete 1 --force 2>/dev/null || true
# Delete "Sample Page"
wp post delete 2 --force 2>/dev/null || true
# Delete "Privacy Policy" template (we'll make our own)
wp post delete 3 --force 2>/dev/null || true
# Delete default comment
wp comment delete 1 --force 2>/dev/null || true
# Remove "Uncategorized" content? Keep the category, but rename.
wp term update category 1 --name="General" --slug="general" 2>/dev/null || true
 
# Disable comments globally by default (blog posts can re-enable)
wp option update default_comment_status closed
wp option update default_ping_status closed
 
# Disable pingbacks (spam vector)
wp option update default_pingback_flag 0
 
ok "Defaults cleaned"
 
# ==========================================
# Install & activate plugins
# ==========================================
log "Installing essential plugins..."
 
PLUGINS=(
    "woocommerce"                         # Commerce engine
    "wordpress-seo"                        # Yoast SEO
    "wp-mail-smtp"                         # Reliable transactional email
    "wordfence"                            # Security / firewall
    "w3-total-cache"                       # Page caching
    "contact-form-7"                       # Contact forms
    "mailchimp-for-wp"                     # Email capture (or swap for Klaviyo plugin)
    "updraftplus"                          # Backups
    "redirection"                          # 301/302 redirects
    "wp-super-cache"                       # Backup cache option if w3tc conflicts
)
 
# Install but don't activate security/cache plugins yet — they'll ask questions
for plugin in "${PLUGINS[@]}"; do
    if wp plugin is-installed "$plugin"; then
        ok "Already installed: $plugin"
    else
        log "Installing: $plugin"
        wp plugin install "$plugin" --quiet
    fi
done
 
# Activate the essential ones immediately
wp plugin activate woocommerce wordpress-seo wp-mail-smtp contact-form-7 mailchimp-for-wp redirection
 
ok "Plugins installed. Activate security/cache after initial setup to avoid config headaches."
 
# ==========================================
# Remove plugins WordPress pre-installs that you don't want
# ==========================================
log "Removing default plugins..."
wp plugin delete akismet hello 2>/dev/null || true
ok "Bloat removed"
 
# ==========================================
# WooCommerce configuration
# ==========================================
log "Configuring WooCommerce..."
 
# Store address
wp option update woocommerce_store_address "Huntington, IN"
wp option update woocommerce_store_city "$BUSINESS_ADDRESS_CITY"
wp option update woocommerce_default_country "${BUSINESS_ADDRESS_COUNTRY}:${BUSINESS_ADDRESS_STATE}"
wp option update woocommerce_store_postcode "46750"
 
# Currency
wp option update woocommerce_currency "$CURRENCY"
wp option update woocommerce_currency_pos "left"
wp option update woocommerce_price_thousand_sep ","
wp option update woocommerce_price_decimal_sep "."
wp option update woocommerce_price_num_decimals 2
 
# Weight / dimensions
wp option update woocommerce_weight_unit "lbs"
wp option update woocommerce_dimension_unit "in"
 
# Selling locations — US only to start
wp option update woocommerce_allowed_countries "specific"
wp option update woocommerce_specific_allowed_countries '["US"]'
wp option update woocommerce_ship_to_countries "specific"
wp option update woocommerce_specific_ship_to_countries '["US"]'
 
# Enable reviews, ratings
wp option update woocommerce_enable_reviews "yes"
wp option update woocommerce_review_rating_verification_required "yes"
 
# Calculate taxes
wp option update woocommerce_calc_taxes "yes"
wp option update woocommerce_prices_include_tax "no"
wp option update woocommerce_tax_based_on "shipping"
wp option update woocommerce_tax_round_at_subtotal "no"
wp option update woocommerce_tax_display_shop "excl"
wp option update woocommerce_tax_display_cart "excl"
 
# Skip onboarding wizard
wp option update woocommerce_onboarding_profile '{"completed":true,"skipped":true}' --format=json
wp option update woocommerce_task_list_hidden "yes"
 
ok "WooCommerce configured for US / Indiana / USD"
 
# ==========================================
# Create WooCommerce product categories
# ==========================================
log "Creating product categories..."
 
wp wc product_cat create --name="Apparel" --slug="apparel" --description="Tees, hoodies, hats, and outerwear" --user=$ADMIN_USER 2>/dev/null || ok "Apparel exists"
wp wc product_cat create --name="Stickers & Decals" --slug="stickers" --description="Vinyl decals, sticker packs, window stickers" --user=$ADMIN_USER 2>/dev/null || ok "Stickers exists"
wp wc product_cat create --name="Digital Downloads" --slug="digital" --description="LUTs, presets, trail guides, PDFs" --user=$ADMIN_USER 2>/dev/null || ok "Digital exists"
wp wc product_cat create --name="Gear We Use" --slug="gear-we-use" --description="Curated gear and affiliate picks from our own builds" --user=$ADMIN_USER 2>/dev/null || ok "Gear exists"
 
ok "Product categories created"
 
# ==========================================
# Create starter products (4 placeholders to match the launch plan)
# ==========================================
log "Creating starter products..."
 
# 1. Flagship Tee
wp wc product create \
    --name="Flagship Tee — Ice" \
    --type="simple" \
    --regular_price="32.00" \
    --description="Our flagship tee. Heavyweight cotton, soft hand feel, Frozen Motorsports full-chest print in ice white on a charcoal base. Runs true to size." \
    --short_description="Charcoal heavyweight tee with ice-white front print." \
    --status="publish" \
    --manage_stock=true \
    --stock_quantity=50 \
    --weight="0.5" \
    --categories="[{\"slug\":\"apparel\"}]" \
    --user=$ADMIN_USER || warn "Tee may already exist"
 
# 2. Icicle F Sticker Pack
wp wc product create \
    --name="Icicle F Sticker · 3-Pack" \
    --type="simple" \
    --regular_price="6.00" \
    --description="Three die-cut vinyl stickers of the Frozen Motorsports F monogram. Weatherproof, UV-resistant, 3 inches tall. Throw them on your rig, your laptop, your toolbox." \
    --short_description="3 die-cut vinyl F monograms. Weatherproof." \
    --status="publish" \
    --manage_stock=true \
    --stock_quantity=200 \
    --weight="0.1" \
    --categories="[{\"slug\":\"stickers\"}]" \
    --user=$ADMIN_USER || warn "Stickers may already exist"
 
# 3. FPV LUT Pack
wp wc product create \
    --name="FPV LUT Pack · Trail Edition" \
    --type="simple" \
    --virtual=true \
    --downloadable=true \
    --regular_price="19.00" \
    --description="Twelve color grading LUTs tuned for dirt, snow, and overcast forest light. Compatible with Premiere, DaVinci, Final Cut, and LUMAfusion. Shot and graded on Sven." \
    --short_description="12 LUTs built for trail, snow, and forest footage." \
    --status="publish" \
    --categories="[{\"slug\":\"digital\"}]" \
    --user=$ADMIN_USER || warn "LUT pack may already exist"
 
# 4. Recovery Kit Bundle (affiliate placeholder — external product linking out)
wp wc product create \
    --name="Recovery Kit Bundle" \
    --type="external" \
    --regular_price="189.00" \
    --external_url="https://frozenmotorsports.com/the-build/#recovery" \
    --button_text="View the Build" \
    --description="The recovery kit we actually use on Sven. Soft shackles, kinetic rope, winch line extension, tree saver, gloves. Affiliate links — we earn a small commission if you buy through these." \
    --short_description="Our real-world trail recovery kit. Affiliate links." \
    --status="publish" \
    --categories="[{\"slug\":\"gear-we-use\"}]" \
    --user=$ADMIN_USER || warn "Recovery Kit may already exist"
 
ok "Starter products created (4)"
 
# ==========================================
# Create starter pages
# ==========================================
log "Creating site pages..."
 
create_page() {
    local title="$1"
    local slug="$2"
    local content="$3"
    local template="${4:-}"
 
    local existing=$(wp post list --post_type=page --name="$slug" --field=ID --format=ids)
    if [ -n "$existing" ]; then
        ok "Page '$title' exists (ID $existing)"
        return
    fi
 
    local args=(--post_type=page --post_status=publish --post_title="$title" --post_name="$slug" --post_author="$(wp user get $ADMIN_USER --field=ID)" --post_content="$content")
    if [ -n "$template" ]; then
        local id=$(wp post create "${args[@]}" --porcelain)
        wp post meta update "$id" _wp_page_template "$template"
    else
        wp post create "${args[@]}" --porcelain >/dev/null
    fi
    ok "Created: $title"
}
 
create_page "Home" "home" "<!-- Homepage content is rendered by the front-page.php template in the Frozen Motorsports theme. -->"
create_page "The Builds" "the-builds" "<h2>Meet Sven</h2><p>Our flagship build. Spec sheet, mod journal, and every affiliate link we use.</p><p><em>Edit this page in the WordPress admin to add the build spec sheet and journal entries.</em></p>"
create_page "Watch" "watch" "<h2>Latest Content</h2><p>YouTube, Instagram, TikTok — everything we're putting out. Embed the latest video below by pasting its URL on a new line.</p>"
create_page "Services" "services" "<h2>Work With Us</h2><h3>FPV Drone Cinematography</h3><p>From \$850 / half-day. Cinematic aerial and FPV work for dealerships, events, brands, and fellow creators.</p><h3>Build Consultation</h3><p>\$125 / session. 45-minute video call, recorded. Platform specs, realistic use case, vendor shortlist.</p><h3>Brand Partnerships</h3><p>By inquiry. Integrated content, dedicated video, event coverage, or full cross-brand build series. <a href='/media-kit/'>Request the media kit.</a></p>"
create_page "Media Kit" "media-kit" "<h2>Media Kit</h2><p>Audience metrics, rate card, and past collaborations. <a href='/contact/'>Request the PDF.</a></p>"
create_page "Trail Reports" "trail-reports" "<h2>Trail Reports</h2><p>Long-form write-ups of trails we've run, product reviews, and how-tos.</p>"
create_page "About" "about" "<h2>About Frozen Motorsports</h2><p>Huntington, Indiana. One Bronco named Sven. Too much coffee. A full garage. Our full story here.</p>"
create_page "Contact" "contact" "<h2>Contact</h2><p>Paste your Contact Form 7 shortcode below, or use the block editor's form block.</p>[contact-form-7 id=\"replace-me\" title=\"Contact\"]"
 
# ==========================================
# Set homepage and blog page
# ==========================================
log "Setting homepage and blog page..."
 
HOME_ID=$(wp post list --post_type=page --name=home --field=ID --format=ids)
if [ -n "$HOME_ID" ]; then
    wp option update show_on_front "page"
    wp option update page_on_front "$HOME_ID"
    ok "Homepage set to 'Home' (ID $HOME_ID)"
fi
 
# Create and assign Trail Reports as posts page
BLOG_ID=$(wp post list --post_type=page --name=trail-reports --field=ID --format=ids)
if [ -n "$BLOG_ID" ]; then
    wp option update page_for_posts "$BLOG_ID"
    ok "Blog page set to 'Trail Reports' (ID $BLOG_ID)"
fi
 
# ==========================================
# Main navigation menu
# ==========================================
log "Building navigation menu..."
 
MENU_NAME="Primary"
wp menu delete "$MENU_NAME" 2>/dev/null || true
wp menu create "$MENU_NAME"
 
add_menu_page() {
    local slug="$1"
    local id=$(wp post list --post_type=page --name="$slug" --field=ID --format=ids)
    if [ -n "$id" ]; then
        wp menu item add-post "$MENU_NAME" "$id"
    fi
}
 
add_menu_page "home"
# Add shop (auto-created by WooCommerce)
SHOP_ID=$(wp post list --post_type=page --name=shop --field=ID --format=ids)
[ -n "$SHOP_ID" ] && wp menu item add-post "$MENU_NAME" "$SHOP_ID"
add_menu_page "the-builds"
add_menu_page "watch"
add_menu_page "services"
add_menu_page "contact"
 
# Assign to theme location
wp menu location assign "$MENU_NAME" primary 2>/dev/null || warn "Theme's 'primary' menu location will be available once theme is activated"
 
ok "Primary menu built"
 
# ==========================================
# Footer menu
# ==========================================
log "Building footer menu..."
 
FOOTER_MENU="Footer"
wp menu delete "$FOOTER_MENU" 2>/dev/null || true
wp menu create "$FOOTER_MENU"
 
for slug in "about" "services" "media-kit" "trail-reports" "contact"; do
    id=$(wp post list --post_type=page --name="$slug" --field=ID --format=ids)
    [ -n "$id" ] && wp menu item add-post "$FOOTER_MENU" "$id"
done
 
wp menu location assign "$FOOTER_MENU" footer 2>/dev/null || true
 
ok "Footer menu built"
 
# ==========================================
# Activate the Frozen Motorsports theme
# ==========================================
log "Activating the Frozen Motorsports theme..."
 
if wp theme is-installed "$THEME_SLUG"; then
    wp theme activate "$THEME_SLUG"
    ok "Theme activated: $THEME_SLUG"
else
    warn "Theme '$THEME_SLUG' not found in wp-content/themes/"
    warn "Upload the theme folder there, then run: wp theme activate $THEME_SLUG"
fi
 
# ==========================================
# Remove default themes (keep 1 as fallback)
# ==========================================
log "Cleaning up default themes..."
for theme in "twentytwentytwo" "twentytwentythree" "twentytwentyfour" "twentytwentyfive"; do
    if wp theme is-installed "$theme" && [ "$theme" != "twentytwentyfive" ]; then
        wp theme delete "$theme" 2>/dev/null || true
    fi
done
ok "Kept twentytwentyfive as fallback"
 
# ==========================================
# SEO defaults (Yoast)
# ==========================================
log "Setting Yoast SEO defaults..."
 
wp option patch update wpseo_titles title-home-wpseo "$SITE_TITLE — $SITE_TAGLINE" 2>/dev/null || true
wp option patch update wpseo_titles metadesc-home-wpseo "Off-road, overland, and FPV cinematography from Huntington, IN. One built Bronco named Sven and the gear we actually use." 2>/dev/null || true
 
ok "SEO defaults configured"
 
# ==========================================
# Reading settings
# ==========================================
wp option update posts_per_page 10
wp option update blog_public 1   # Allow search engines
 
# ==========================================
# Done
# ==========================================
echo
log "============================================"
log "  Setup complete."
log "============================================"
echo
ok "Site URL:     $SITE_URL"
ok "Admin:        $SITE_URL/wp-admin"
ok "User:         $ADMIN_USER"
echo
warn "Manual steps remaining (see README.md):"
echo "  1. Configure Shopify Payments... wait, wrong platform. Configure your payment gateway (WooCommerce → Settings → Payments)"
echo "  2. Register for Indiana Sales Tax permit and enter rates"
echo "  3. Upload your logo (Appearance → Customize → Site Identity)"
echo "  4. Upload favicon (same screen)"
echo "  5. Configure WP Mail SMTP with a real sender (Gmail, SendGrid, etc.)"
echo "  6. Activate Wordfence and W3 Total Cache after the theme looks good"
echo "  7. Configure Mailchimp for WP (or swap for your email platform)"
echo "  8. Generate Privacy Policy, Terms, Refund, Shipping policies (WooCommerce → Settings → Advanced → Page setup has starters)"
# ==========================================
# CONFIG — edit these
 before running
# ==========================================
SITE_URL="https://frozenmotorsports.com"
SITE_TITLE="Frozen Motorsports"
SITE_TAGLINE="Off-Road. Overland. Filmed."
ADMIN_USER="chris"
ADMIN_EMAIL="chris@frozenmotorsports.com"
ADMIN_PASSWORD=""   # Leave blank to be prompted, or set here
BUSINESS_ADDRESS_CITY="Huntington"
BUSINESS_ADDRESS_STATE="IN"
BUSINESS_ADDRESS_COUNTRY="US"
CURRENCY="USD"
 
# Theme to activate (must be uploaded to wp-content/themes/ first)
THEME_SLUG="frozen-motorsports"
 
# ==========================================
# Helper functions
# ==========================================
log() { echo -e "\033[1;36m[FZN]\033[0m $*"; }
ok()  { echo -e "\033[1;32m [✓]\033[0m $*"; }
warn(){ echo -e "\033[1;33m [!]\033[0m $*"; }
die() { echo -e "\033[1;31m [✗]\033[0m $*" >&2; exit 1; }
 
# ==========================================
# Preflight checks
# ==========================================
log "Preflight checks..."
 
command -v wp >/dev/null || die "WP-CLI not found. Install it or run commands manually via WP admin."
wp core is-installed --quiet || die "WordPress is not installed yet. Run 'wp core install' first or install via your host's installer."
 
ok "WP-CLI found: $(wp --version)"
ok "WordPress installed: $(wp core version)"
 
# ==========================================
# Core settings
# ==========================================
log "Configuring core settings..."
 
wp option update blogname "$SITE_TITLE"
wp option update blogdescription "$SITE_TAGLINE"
wp option update admin_email "$ADMIN_EMAIL"
wp option update siteurl "$SITE_URL"
wp option update home "$SITE_URL"
wp option update timezone_string "America/Indiana/Indianapolis"
wp option update date_format "F j, Y"
wp option update time_format "g:i a"
wp option update start_of_week 1
 
# Permalinks: post name (pretty URLs)
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
 
ok "Core settings configured"
 
# ==========================================
# Clean up default content
# ==========================================
log "Removing default WordPress clutter..."
 
# Delete "Hello world!" post
wp post delete 1 --force 2>/dev/null || true
# Delete "Sample Page"
wp post delete 2 --force 2>/dev/null || true
# Delete "Privacy Policy" template (we'll make our own)
wp post delete 3 --force 2>/dev/null || true
# Delete default comment
wp comment delete 1 --force 2>/dev/null || true
# Remove "Uncategorized" content? Keep the category, but rename.
wp term update category 1 --name="General" --slug="general" 2>/dev/null || true
 
# Disable comments globally by default (blog posts can re-enable)
wp option update default_comment_status closed
wp option update default_ping_status closed
 
# Disable pingbacks (spam vector)
wp option update default_pingback_flag 0
 
ok "Defaults cleaned"
 
# ==========================================
# Install & activate plugins
# ==========================================
log "Installing essential plugins..."
 
PLUGINS=(
    "woocommerce"                         # Commerce engine
    "wordpress-seo"                        # Yoast SEO
    "wp-mail-smtp"                         # Reliable transactional email
    "wordfence"                            # Security / firewall
    "w3-total-cache"                       # Page caching
    "contact-form-7"                       # Contact forms
    "mailchimp-for-wp"                     # Email capture (or swap for Klaviyo plugin)
    "updraftplus"                          # Backups
    "redirection"                          # 301/302 redirects
    "wp-super-cache"                       # Backup cache option if w3tc conflicts
)
 
# Install but don't activate security/cache plugins yet — they'll ask questions
for plugin in "${PLUGINS[@]}"; do
    if wp plugin is-installed "$plugin"; then
        ok "Already installed: $plugin"
    else
        log "Installing: $plugin"
        wp plugin install "$plugin" --quiet
    fi
done
 
# Activate the essential ones immediately
wp plugin activate woocommerce wordpress-seo wp-mail-smtp contact-form-7 mailchimp-for-wp redirection
 
ok "Plugins installed. Activate security/cache after initial setup to avoid config headaches."
 
# ==========================================
# Remove plugins WordPress pre-installs that you don't want
# ==========================================
log "Removing default plugins..."
wp plugin delete akismet hello 2>/dev/null || true
ok "Bloat removed"
 
# ==========================================
# WooCommerce configuration
# ==========================================
log "Configuring WooCommerce..."
 
# Store address
wp option update woocommerce_store_address "Huntington, IN"
wp option update woocommerce_store_city "$BUSINESS_ADDRESS_CITY"
wp option update woocommerce_default_country "${BUSINESS_ADDRESS_COUNTRY}:${BUSINESS_ADDRESS_STATE}"
wp option update woocommerce_store_postcode "46750"
 
# Currency
wp option update woocommerce_currency "$CURRENCY"
wp option update woocommerce_currency_pos "left"
wp option update woocommerce_price_thousand_sep ","
wp option update woocommerce_price_decimal_sep "."
wp option update woocommerce_price_num_decimals 2
 
# Weight / dimensions
wp option update woocommerce_weight_unit "lbs"
wp option update woocommerce_dimension_unit "in"
 
# Selling locations — US only to start
wp option update woocommerce_allowed_countries "specific"
wp option update woocommerce_specific_allowed_countries '["US"]'
wp option update woocommerce_ship_to_countries "specific"
wp option update woocommerce_specific_ship_to_countries '["US"]'
 
# Enable reviews, ratings
wp option update woocommerce_enable_reviews "yes"
wp option update woocommerce_review_rating_verification_required "yes"
 
# Calculate taxes
wp option update woocommerce_calc_taxes "yes"
wp option update woocommerce_prices_include_tax "no"
wp option update woocommerce_tax_based_on "shipping"
wp option update woocommerce_tax_round_at_subtotal "no"
wp option update woocommerce_tax_display_shop "excl"
wp option update woocommerce_tax_display_cart "excl"
 
# Skip onboarding wizard
wp option update woocommerce_onboarding_profile '{"completed":true,"skipped":true}' --format=json
wp option update woocommerce_task_list_hidden "yes"
 
ok "WooCommerce configured for US / Indiana / USD"
 
# ==========================================
# Create WooCommerce product categories
# ==========================================
log "Creating product categories..."
 
wp wc product_cat create --name="Apparel" --slug="apparel" --description="Tees, hoodies, hats, and outerwear" --user=$ADMIN_USER 2>/dev/null || ok "Apparel exists"
wp wc product_cat create --name="Stickers & Decals" --slug="stickers" --description="Vinyl decals, sticker packs, window stickers" --user=$ADMIN_USER 2>/dev/null || ok "Stickers exists"
wp wc product_cat create --name="Digital Downloads" --slug="digital" --description="LUTs, presets, trail guides, PDFs" --user=$ADMIN_USER 2>/dev/null || ok "Digital exists"
wp wc product_cat create --name="Gear We Use" --slug="gear-we-use" --description="Curated gear and affiliate picks from our own builds" --user=$ADMIN_USER 2>/dev/null || ok "Gear exists"
 
ok "Product categories created"
 
# ==========================================
# Create starter products (4 placeholders to match the launch plan)
# ==========================================
log "Creating starter products..."
 
# 1. Flagship Tee
wp wc product create \
    --name="Flagship Tee — Ice" \
    --type="simple" \
    --regular_price="32.00" \
    --description="Our flagship tee. Heavyweight cotton, soft hand feel, Frozen Motorsports full-chest print in ice white on a charcoal base. Runs true to size." \
    --short_description="Charcoal heavyweight tee with ice-white front print." \
    --status="publish" \
    --manage_stock=true \
    --stock_quantity=50 \
    --weight="0.5" \
    --categories="[{\"slug\":\"apparel\"}]" \
    --user=$ADMIN_USER || warn "Tee may already exist"
 
# 2. Icicle F Sticker Pack
wp wc product create \
    --name="Icicle F Sticker · 3-Pack" \
    --type="simple" \
    --regular_price="6.00" \
    --description="Three die-cut vinyl stickers of the Frozen Motorsports F monogram. Weatherproof, UV-resistant, 3 inches tall. Throw them on your rig, your laptop, your toolbox." \
    --short_description="3 die-cut vinyl F monograms. Weatherproof." \
    --status="publish" \
    --manage_stock=true \
    --stock_quantity=200 \
    --weight="0.1" \
    --categories="[{\"slug\":\"stickers\"}]" \
    --user=$ADMIN_USER || warn "Stickers may already exist"
 
# 3. FPV LUT Pack
wp wc product create \
    --name="FPV LUT Pack · Trail Edition" \
    --type="simple" \
    --virtual=true \
    --downloadable=true \
    --regular_price="19.00" \
    --description="Twelve color grading LUTs tuned for dirt, snow, and overcast forest light. Compatible with Premiere, DaVinci, Final Cut, and LUMAfusion. Shot and graded on Sven." \
    --short_description="12 LUTs built for trail, snow, and forest footage." \
    --status="publish" \
    --categories="[{\"slug\":\"digital\"}]" \
    --user=$ADMIN_USER || warn "LUT pack may already exist"
 
# 4. Recovery Kit Bundle (affiliate placeholder — external product linking out)
wp wc product create \
    --name="Recovery Kit Bundle" \
    --type="external" \
    --regular_price="189.00" \
    --external_url="https://frozenmotorsports.com/the-build/#recovery" \
    --button_text="View the Build" \
    --description="The recovery kit we actually use on Sven. Soft shackles, kinetic rope, winch line extension, tree saver, gloves. Affiliate links — we earn a small commission if you buy through these." \
    --short_description="Our real-world trail recovery kit. Affiliate links." \
    --status="publish" \
    --categories="[{\"slug\":\"gear-we-use\"}]" \
    --user=$ADMIN_USER || warn "Recovery Kit may already exist"
 
ok "Starter products created (4)"
 
# ==========================================
# Create starter pages
# ==========================================
log "Creating site pages..."
 
create_page() {
    local title="$1"
    local slug="$2"
    local content="$3"
    local template="${4:-}"
 
    local existing=$(wp post list --post_type=page --name="$slug" --field=ID --format=ids)
    if [ -n "$existing" ]; then
        ok "Page '$title' exists (ID $existing)"
        return
    fi
 
    local args=(--post_type=page --post_status=publish --post_title="$title" --post_name="$slug" --post_author="$(wp user get $ADMIN_USER --field=ID)" --post_content="$content")
    if [ -n "$template" ]; then
        local id=$(wp post create "${args[@]}" --porcelain)
        wp post meta update "$id" _wp_page_template "$template"
    else
        wp post create "${args[@]}" --porcelain >/dev/null
    fi
    ok "Created: $title"
}
 
create_page "Home" "home" "<!-- Homepage content is rendered by the front-page.php template in the Frozen Motorsports theme. -->"
create_page "The Builds" "the-builds" "<h2>Meet Sven</h2><p>Our flagship build. Spec sheet, mod journal, and every affiliate link we use.</p><p><em>Edit this page in the WordPress admin to add the build spec sheet and journal entries.</em></p>"
create_page "Watch" "watch" "<h2>Latest Content</h2><p>YouTube, Instagram, TikTok — everything we're putting out. Embed the latest video below by pasting its URL on a new line.</p>"
create_page "Services" "services" "<h2>Work With Us</h2><h3>FPV Drone Cinematography</h3><p>From \$850 / half-day. Cinematic aerial and FPV work for dealerships, events, brands, and fellow creators.</p><h3>Build Consultation</h3><p>\$125 / session. 45-minute video call, recorded. Platform specs, realistic use case, vendor shortlist.</p><h3>Brand Partnerships</h3><p>By inquiry. Integrated content, dedicated video, event coverage, or full cross-brand build series. <a href='/media-kit/'>Request the media kit.</a></p>"
create_page "Media Kit" "media-kit" "<h2>Media Kit</h2><p>Audience metrics, rate card, and past collaborations. <a href='/contact/'>Request the PDF.</a></p>"
create_page "Trail Reports" "trail-reports" "<h2>Trail Reports</h2><p>Long-form write-ups of trails we've run, product reviews, and how-tos.</p>"
create_page "About" "about" "<h2>About Frozen Motorsports</h2><p>Huntington, Indiana. One Bronco named Sven. Too much coffee. A full garage. Our full story here.</p>"
create_page "Contact" "contact" "<h2>Contact</h2><p>Paste your Contact Form 7 shortcode below, or use the block editor's form block.</p>[contact-form-7 id=\"replace-me\" title=\"Contact\"]"
 
# ==========================================
# Set homepage and blog page
# ==========================================
log "Setting homepage and blog page..."
 
HOME_ID=$(wp post list --post_type=page --name=home --field=ID --format=ids)
if [ -n "$HOME_ID" ]; then
    wp option update show_on_front "page"
    wp option update page_on_front "$HOME_ID"
    ok "Homepage set to 'Home' (ID $HOME_ID)"
fi
 
# Create and assign Trail Reports as posts page
BLOG_ID=$(wp post list --post_type=page --name=trail-reports --field=ID --format=ids)
if [ -n "$BLOG_ID" ]; then
    wp option update page_for_posts "$BLOG_ID"
    ok "Blog page set to 'Trail Reports' (ID $BLOG_ID)"
fi
 
# ==========================================
# Main navigation menu
# ==========================================
log "Building navigation menu..."
 
MENU_NAME="Primary"
wp menu delete "$MENU_NAME" 2>/dev/null || true
wp menu create "$MENU_NAME"
 
add_menu_page() {
    local slug="$1"
    local id=$(wp post list --post_type=page --name="$slug" --field=ID --format=ids)
    if [ -n "$id" ]; then
        wp menu item add-post "$MENU_NAME" "$id"
    fi
}
 
add_menu_page "home"
# Add shop (auto-created by WooCommerce)
SHOP_ID=$(wp post list --post_type=page --name=shop --field=ID --format=ids)
[ -n "$SHOP_ID" ] && wp menu item add-post "$MENU_NAME" "$SHOP_ID"
add_menu_page "the-builds"
add_menu_page "watch"
add_menu_page "services"
add_menu_page "contact"
 
# Assign to theme location
wp menu location assign "$MENU_NAME" primary 2>/dev/null || warn "Theme's 'primary' menu location will be available once theme is activated"
 
ok "Primary menu built"
 
# ==========================================
# Footer menu
# ==========================================
log "Building footer menu..."
 
FOOTER_MENU="Footer"
wp menu delete "$FOOTER_MENU" 2>/dev/null || true
wp menu create "$FOOTER_MENU"
 
for slug in "about" "services" "media-kit" "trail-reports" "contact"; do
    id=$(wp post list --post_type=page --name="$slug" --field=ID --format=ids)
    [ -n "$id" ] && wp menu item add-post "$FOOTER_MENU" "$id"
done
 
wp menu location assign "$FOOTER_MENU" footer 2>/dev/null || true
 
ok "Footer menu built"
 
# ==========================================
# Activate the Frozen Motorsports theme
# ==========================================
log "Activating the Frozen Motorsports theme..."
 
if wp theme is-installed "$THEME_SLUG"; then
    wp theme activate "$THEME_SLUG"
    ok "Theme activated: $THEME_SLUG"
else
    warn "Theme '$THEME_SLUG' not found in wp-content/themes/"
    warn "Upload the theme folder there, then run: wp theme activate $THEME_SLUG"
fi
 
# ==========================================
# Remove default themes (keep 1 as fallback)
# ==========================================
log "Cleaning up default themes..."
for theme in "twentytwentytwo" "twentytwentythree" "twentytwentyfour" "twentytwentyfive"; do
    if wp theme is-installed "$theme" && [ "$theme" != "twentytwentyfive" ]; then
        wp theme delete "$theme" 2>/dev/null || true
    fi
done
ok "Kept twentytwentyfive as fallback"
 
# ==========================================
# SEO defaults (Yoast)
# ==========================================
log "Setting Yoast SEO defaults..."
 
wp option patch update wpseo_titles title-home-wpseo "$SITE_TITLE — $SITE_TAGLINE" 2>/dev/null || true
wp option patch update wpseo_titles metadesc-home-wpseo "Off-road, overland, and FPV cinematography from Huntington, IN. One built Bronco named Sven and the gear we actually use." 2>/dev/null || true
 
ok "SEO defaults configured"
 
# ==========================================
# Reading settings
# ==========================================
wp option update posts_per_page 10
wp option update blog_public 1   # Allow search engines
 
# ==========================================
# Done
# ==========================================
echo
log "============================================"
log "  Setup complete."
log "============================================"
echo
ok "Site URL:     $SITE_URL"
ok "Admin:        $SITE_URL/wp-admin"
ok "User:         $ADMIN_USER"
echo
warn "Manual steps remaining (see README.md):"
echo "  1. Configure Shopify Payments... wait, wrong platform. Configure your payment gateway (WooCommerce → Settings → Payments)"
echo "  2. Register for Indiana Sales Tax permit and enter rates"
echo "  3. Upload your logo (Appearance → Customize → Site Identity)"
echo "  4. Upload favicon (same screen)"
echo "  5. Configure WP Mail SMTP with a real sender (Gmail, SendGrid, etc.)"
echo "  6. Activate Wordfence and W3 Total Cache after the theme looks good"
echo "  7. Configure Mailchimp for WP (or swap for your email platform)"
echo "  8. Generate Privacy Policy, Terms, Refund, Shipping policies (WooCommerce → Settings → Advanced → Page setup has starters)"

Frozen Motorsports

Off-Road · Overland · Filmed