# Build an UPDATED theme zip that auto-creates demo pages + products on activation.
# It will also include placeholder jersey images with club colors and the user’s fitness-set image.
import os, zipfile, textwrap, shutil
from PIL import Image, ImageDraw, ImageFont
base = “/mnt/data/fitjersey-sporty-demo”
assets = os.path.join(base, “assets”)
os.makedirs(assets, exist_ok=True)
# ———- Helper: create simple jersey placeholders ———-
def draw_jersey(filename, team, colors):
w, h = 1200, 1200
img = Image.new(“RGB”, (w, h), color=(255,255,255))
d = ImageDraw.Draw(img)
# Shirt body
body_margin = 120
d.rounded_rectangle([body_margin, 150, w-body_margin, h-150], radius=60, fill=colors[0], outline=(0,0,0), width=6)
# Sleeves
d.rounded_rectangle([60, 200, 260, 520], radius=40, fill=colors[0], outline=(0,0,0), width=6)
d.rounded_rectangle([w-260, 200, w-60, 520], radius=40, fill=colors[0], outline=(0,0,0), width=6)
# Accent stripes if provided
if len(colors) > 1:
# vertical stripe
d.rectangle([w//2-40, 150, w//2+40, h-150], fill=colors[1])
# Crest (simple shield)
cx, cy = w//2 + 220, 360
d.pieslice([cx-70, cy-70, cx+70, cy+70], 0, 360, fill=(255,255,255), outline=(0,0,0), width=5)
# Team name text
label = f”{team} Jersey”
d.text((80, 1040), label, fill=(0,0,0))
img.save(os.path.join(assets, filename), quality=90)
# Team jersey images
teams = [
(“arsenal.jpg”, “Arsenal”, [(200,0,0), (255,255,0)]), # red, yellow stripe
(“manutd.jpg”, “Man Utd”, [(180,0,0), (0,0,0)]), # red, black stripe
(“barcelona.jpg”, “Barcelona”, [(10,40,120), (140,0,0)]), # blue, garnet stripe
(“realmadrid.jpg”, “Real Madrid”, [(245,245,245), (0,0,120)]), # white, blue stripe
]
for fn, team, cols in teams:
draw_jersey(fn, team, cols)
# Fitness set image: copy from user’s upload if exists; otherwise create placeholder
user_img = “/mnt/data/29495F7A-DAC6-4505-81D9-B1C201933235.jpeg”
fitness_path = os.path.join(assets, “fitness-set.jpg”)
if os.path.exists(user_img):
shutil.copy(user_img, fitness_path)
else:
# simple placeholder
img = Image.new(“RGB”, (1200, 1200), color=(230,230,230))
d = ImageDraw.Draw(img)
d.rectangle([100,100,1100,1100], outline=(0,0,0), width=6)
d.text((140,560), “Fitness 3-Piece Set”, fill=(0,0,0))
img.save(fitness_path, quality=90)
# ———- Theme files ———-
style_css = textwrap.dedent(“””
/*
Theme Name: FitJersey Sporty (Demo Pack)
Theme URI: https://example.com/fitjersey-sporty
Author: ChatGPT
Author URI: https://openai.com
Description: Clean, sporty WooCommerce theme for FitJersey.com with demo content (jerseys + fitness set).
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: e-commerce, woocommerce, responsive, minimal, sporty
Text Domain: fitjersey-sporty
*/
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body { font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Oxygen, Ubuntu, Cantarell, Arial; line-height:1.6; color:#111; background:#fff; }
a { text-decoration:none; color:inherit; }
img { max-width:100%; height:auto; display:block; }
.container { max-width:1200px; margin:0 auto; padding:0 16px; }
.header { border-bottom:1px solid #eee; background:#fff; position:sticky; top:0; z-index:99; }
.navbar { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; }
.brand { font-weight:800; font-size:1.4rem; }
.brand .dotcom { font-weight:600; opacity:.8; }
.nav { display:flex; gap:16px; flex-wrap:wrap; align-items:center; }
.nav a { padding:8px 10px; border-radius:6px; }
.nav a:hover { background:#f6f6f6; }
.btn, .button { display:inline-block; padding:12px 18px; border-radius:10px; border:none; font-weight:700; cursor:pointer; }
.btn-primary { background:#111; color:#fff; }
.btn-ghost { background:transparent; border:1px solid #ddd; }
.section { padding:28px 0; }
.grid { display:grid; gap:16px; }
.grid.cols-3 { grid-template-columns:repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns:repeat(4, minmax(0,1fr)); }
.card { border:1px solid #eee; border-radius:14px; overflow:hidden; background:#fff; display:flex; flex-direction:column; }
.card .thumb { background:#f6f6f6; aspect-ratio:4/3; display:flex; align-items:center; justify-content:center; font-weight:700; color:#aaa; }
.card .body { padding:12px; display:flex; flex-direction:column; gap:8px; }
.price { font-weight:800; }
.hero { display:grid; grid-template-columns:1.2fr 1fr; gap:24px; align-items:center; padding:34px 0; }
.hero-card { background:#fafafa; border:1px solid #eee; border-radius:16px; padding:28px; }
.hero h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); margin: 10px 0; }
.hero .actions { display:flex; gap:12px; margin-top:14px; flex-wrap:wrap; }
.hero .metrics { display:flex; gap:16px; margin-top:18px; flex-wrap:wrap; }
.metric { background:#fff; border:1px solid #eee; border-radius:12px; padding:10px 14px; font-weight:700; }
.hero-img { background:#f2f2f2; border:1px solid #eee; border-radius:16px; overflow:hidden; display:flex; align-items:center; justify-content:center; }
.hero-img-placeholder { aspect-ratio:4/3; width:100%; display:grid; place-items:center; font-weight:700; color:#999; }
.testimonials { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:16px; }
.quote { background:#fafafa; border:1px solid #eee; border-radius:12px; padding:14px; font-style:italic; }
.newsletter { background:#111; color:#fff; border-radius:14px; padding:18px; display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.newsletter input { padding:12px; border-radius:10px; border:none; min-width:240px; }
.newsletter button { background:#e10600; color:#fff; border:none; padding:12px 18px; border-radius:10px; font-weight:700; cursor:pointer; }
.footer { border-top:1px solid #eee; margin-top:22px; }
.footer-inner { display:grid; grid-template-columns:2fr 1fr 1fr 1fr; gap:16px; padding:18px 0; }
.socials { display:flex; gap:10px; align-items:center; }
.woocommerce ul.products li.product .button { background:#111; color:#fff; border-radius:8px; }
.woocommerce a.button, .woocommerce button.button { background:#111; color:#fff; border-radius:8px; }
.woocommerce span.onsale { background:#e10600; }
@media (max-width: 900px) {
.hero { grid-template-columns:1fr; }
.grid.cols-3, .grid.cols-4 { grid-template-columns:1fr 1fr; }
.testimonials { grid-template-columns:1fr; }
.footer-inner { grid-template-columns:1fr 1fr; }
}
“””)
functions_php = textwrap.dedent(r”””
60, ‘width’ => 200, ‘flex-height’ => true, ‘flex-width’ => true,
]);
register_nav_menus([‘primary’ => ‘Primary Menu’, ‘footer’ => ‘Footer Menu’]);
});
add_action(‘wp_enqueue_scripts’, function() {
wp_enqueue_style(‘fitjersey-style’, get_stylesheet_uri(), [], ‘1.1.0’);
});
// DEMO CONTENT: runs once on activation
add_action(‘after_switch_theme’, function() {
if ( get_option(‘fitjersey_demo_installed’) ) { return; }
// Create pages: Home, About, FAQ, Returns, Contact (simple content)
$pages = [
‘Home’ => [‘content’ => ”, ‘slug’ => ‘home’],
‘About’ => [‘content’ => ‘We sell authentic club jerseys and quality fitness gear. Fast delivery across Nigeria.’, ‘slug’ => ‘about’],
‘FAQ’ => [‘content’ => “Q: Do you deliver nationwide?\nA: Yes.\n\nQ: Do you accept returns?\nA: 7-day return for unused products.”, ‘slug’ => ‘faq’],
‘Returns’ => [‘content’ => ‘Return unused items within 7 days for a refund or exchange.’, ‘slug’ => ‘returns’],
‘Contact’ => [‘content’ => ‘WhatsApp | Instagram | Email | Facebook’, ‘slug’ => ‘contact’],
];
$page_ids = [];
foreach ($pages as $title => $data) {
$existing = get_page_by_title($title);
if ($existing) { $page_ids[$title] = $existing->ID; continue; }
$pid = wp_insert_post([
‘post_title’ => $title,
‘post_name’ => sanitize_title($data[‘slug’]),
‘post_content’ => wp_kses_post($data[‘content’]),
‘post_status’ => ‘publish’,
‘post_type’ => ‘page’,
]);
$page_ids[$title] = $pid;
}
// Set Home as static front page
if (isset($page_ids[‘Home’])) {
update_option(‘show_on_front’, ‘page’);
update_option(‘page_on_front’, $page_ids[‘Home’]);
}
// Create a simple menu if none exists
if ( ! has_nav_menu(‘primary’) ) {
$menu_id = wp_create_nav_menu(‘Main Menu’);
wp_update_nav_menu_item($menu_id, 0, [‘menu-item-title’ => ‘Home’, ‘menu-item-object’ => ‘page’, ‘menu-item-object-id’ => $page_ids[‘Home’], ‘menu-item-type’ => ‘post_type’, ‘menu-item-status’ => ‘publish’]);
$shop_id = function_exists(‘wc_get_page_id’) ? wc_get_page_id(‘shop’) : 0;
if ($shop_id > 0) {
wp_update_nav_menu_item($menu_id, 0, [‘menu-item-title’ => ‘Shop’, ‘menu-item-object’ => ‘page’, ‘menu-item-object-id’ => $shop_id, ‘menu-item-type’ => ‘post_type’, ‘menu-item-status’ => ‘publish’]);
}
wp_update_nav_menu_item($menu_id, 0, [‘menu-item-title’ => ‘About’, ‘menu-item-object’ => ‘page’, ‘menu-item-object-id’ => $page_ids[‘About’], ‘menu-item-type’ => ‘post_type’, ‘menu-item-status’ => ‘publish’]);
wp_update_nav_menu_item($menu_id, 0, [‘menu-item-title’ => ‘Contact’, ‘menu-item-object’ => ‘page’, ‘menu-item-object-id’ => $page_ids[‘Contact’], ‘menu-item-type’ => ‘post_type’, ‘menu-item-status’ => ‘publish’]);
set_theme_mod(‘nav_menu_locations’, [‘primary’ => $menu_id]);
}
// Only proceed if WooCommerce exists
if ( ! class_exists(‘WooCommerce’) ) {
update_option(‘fitjersey_demo_installed’, 1);
return;
}
// Ensure product categories exist
$jersey_term = term_exists(‘Jerseys’, ‘product_cat’);
if ( ! $jersey_term ) { $jersey_term = wp_insert_term(‘Jerseys’, ‘product_cat’); }
$fitness_term = term_exists(‘Fitness Gear’, ‘product_cat’);
if ( ! $fitness_term ) { $fitness_term = wp_insert_term(‘Fitness Gear’, ‘product_cat’); }
// Helper to import an image from theme assets into Media Library
function fitjersey_import_image($filename){
$path = get_template_directory() . ‘/assets/’ . $filename;
if ( ! file_exists($path) ) return 0;
$bits = file_get_contents($path);
$upload = wp_upload_bits($filename, null, $bits);
if ( $upload[‘error’] ) return 0;
$filetype = wp_check_filetype($upload[‘file’]);
$attachment_id = wp_insert_attachment([
‘post_mime_type’ => $filetype[‘type’],
‘post_title’ => sanitize_file_name($filename),
‘post_content’ => ”,
‘post_status’ => ‘inherit’
], $upload[‘file’]);
require_once(ABSPATH . ‘wp-admin/includes/image.php’);
$attach_data = wp_generate_attachment_metadata($attachment_id, $upload[‘file’]);
wp_update_attachment_metadata($attachment_id, $attach_data);
return $attachment_id;
}
// Helper to create a simple product
function fitjersey_create_product($name, $price, $image_filename, $category){
// Check if product already exists
$existing = get_page_by_title($name, OBJECT, ‘product’);
if ( $existing ) return $existing->ID;
$pid = wp_insert_post([
‘post_title’ => $name,
‘post_content’ => $name . ‘ — quality fabric and authentic look.’,
‘post_status’ => ‘publish’,
‘post_type’ => ‘product’
]);
if ( is_wp_error($pid) ) return 0;
wp_set_object_terms($pid, $category, ‘product_cat’, true);
update_post_meta($pid, ‘_regular_price’, $price);
update_post_meta($pid, ‘_price’, $price);
update_post_meta($pid, ‘_manage_stock’, ‘no’);
update_post_meta($pid, ‘_stock_status’, ‘instock’);
update_post_meta($pid, ‘_visibility’, ‘visible’);
update_post_meta($pid, ‘_virtual’, ‘no’);
update_post_meta($pid, ‘_downloadable’, ‘no’);
wp_set_object_terms($pid, ‘simple’, ‘product_type’);
$att_id = fitjersey_import_image($image_filename);
if ( $att_id ) {
set_post_thumbnail($pid, $att_id);
update_post_meta($pid, ‘_thumbnail_id’, $att_id);
}
return $pid;
}
// Create demo products with sample prices
fitjersey_create_product(‘Arsenal Jersey’, ‘15000’, ‘arsenal.jpg’, ‘Jerseys’);
fitjersey_create_product(‘Man Utd Jersey’, ‘15000’, ‘manutd.jpg’, ‘Jerseys’);
fitjersey_create_product(‘Barcelona Jersey’, ‘15000’, ‘barcelona.jpg’, ‘Jerseys’);
fitjersey_create_product(‘Real Madrid Jersey’, ‘15000’, ‘realmadrid.jpg’, ‘Jerseys’);
fitjersey_create_product(‘Fitness 3-Piece Set’, ‘20000’, ‘fitness-set.jpg’, ‘Fitness Gear’);
update_option(‘fitjersey_demo_installed’, 1);
});
// Shortcode helper
function fitjersey_sc($code){ return do_shortcode($code); }
“””)
header_php = textwrap.dedent(“””
<html >
<meta charset=””>
<body >
“””)
footer_php = textwrap.dedent(“””
“””)
front_page_php = textwrap.dedent(“””
Club Jerseys & Fitness Gear – Built for Performance
Shop Arsenal, Man Utd, Barcelona, Real Madrid and more. Fast delivery across Nigeria.
<a class=”btn btn-ghost” href=””>Contact Us
Shop by Category
Jerseys • Fitness • Accessories
From ₦12,000
<a class=”button btn-primary” href=””>Shop Jerseys
From ₦10,000
<a class=”button btn-primary” href=””>Shop Fitness
From ₦3,000
<a class=”button btn-primary” href=””>Shop Accessories
Featured Products
Arsenal, Man Utd, Barcelona, Real Madrid jerseys + Fitness set
What customers say
“””)
index_php = textwrap.dedent(“””
Latest Posts
<a href=””>
No content yet. Create pages and set your Homepage to “A static page” in Settings → Reading.
“””)
woocommerce_php = textwrap.dedent(“””
“””)
page_php = textwrap.dedent(“””
“””)
screenshot_path = os.path.join(base, “screenshot.png”)
img = Image.new(“RGB”, (1200, 900), color=(255,255,255))
d = ImageDraw.Draw(img)
d.rectangle([40,40,1160,200], outline=(0,0,0), width=4)
d.text((60,70), “FitJersey.com – Sporty WooCommerce Theme (Demo)”, fill=(0,0,0))
d.rectangle([40,220,560,520], outline=(0,0,0), width=2)
d.text((60,240), “Hero Banner”, fill=(0,0,0))
d.rectangle([580,220,1160,520], outline=(0,0,0), width=2)
d.text((600,240), “Hero Image”, fill=(0,0,0))
d.text((40,540), “Demo: 4 Club Jerseys + Fitness Set (with sample prices)”, fill=(0,0,0))
img.save(screenshot_path)
# Write files
files = {
“style.css”: style_css,
“functions.php”: functions_php,
“header.php”: header_php,
“footer.php”: footer_php,
“front-page.php”: front_page_php,
“index.php”: index_php,
“woocommerce.php”: woocommerce_php,
“page.php”: page_php,
}
for name, content in files.items():
with open(os.path.join(base, name), “w”, encoding=”utf-8″) as f:
f.write(content)
# Zip
zip_path = “/mnt/data/fitjersey-sporty-demo.zip”
with zipfile.ZipFile(zip_path, ‘w’, zipfile.ZIP_DEFLATED) as z:
for root, dirs, fs in os.walk(base):
for fn in fs:
full = os.path.join(root, fn)
rel = os.path.relpath(full, os.path.dirname(base))
z.write(full, arcname=rel)
zip_path