Skip to content

Repository files navigation

Battery Australia — WordPress

Custom WooCommerce site ported from a Laravel codebase. Pure WordPress now — no Laravel artefacts in the codebase.

What's in this repo

Path Purpose
wp-admin/, wp-includes/, root *.php WordPress core (version-locked)
wp-content/themes/battery-australia/ Custom theme (header, footer, page templates, WooCommerce overrides)
wp-content/plugins/battery-bookings/ Custom plugin — service-booking CPT + admin UI + form handler
wp-config-sample.php Reference config (real wp-config.php is gitignored — has DB creds + salts)

Third-party plugins, default themes, user uploads, caches, and secrets are intentionally not tracked — see .gitignore.

First-time setup

# 1. Clone
git clone <repo-url> wordpress-project && cd wordpress-project

# 2. Create a local wp-config.php (use wp-config-sample.php as a starting point)
cp wp-config-sample.php wp-config.php
# Edit DB_NAME, DB_USER, DB_PASSWORD, DB_HOST + replace salts:
#   curl -s https://api.wordpress.org/secret-key/1.1/salt/

# 3. Create the database
mysql -u root -e "CREATE DATABASE wordpress_database CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

# 4. Install WordPress
wp core install \
  --url="http://localhost:8000" \
  --title="Battery Australia" \
  --admin_user="admin" --admin_password="admin123" \
  --admin_email="admin@battery.local" --skip-email

# 5. Install third-party plugins
wp plugin install woocommerce woocommerce-gateway-stripe \
                  woocommerce-paypal-payments wordpress-seo --activate

# 6. Activate our theme + plugin
wp theme activate battery-australia
wp plugin activate battery-bookings

# 7. Disable WC "coming soon" and set permalink structure
wp option update woocommerce_coming_soon "no"
wp rewrite structure '/%postname%/' --hard

# 8. Run the migration (if importing from the Laravel `battery_database`)
wp eval-file /tmp/ba-migrate.php

# 9. Start the dev server
php -S localhost:8000

Site live at http://localhost:8000, admin at http://localhost:8000/wp-admin/ (admin / admin123).

Admin-editable surfaces

After login, the client can manage:

  • Settings → Battery Australia — phone, email, addresses, social links, logo, fitting fee, footer text, schema rating (21 fields)
  • Appearance → Menus — primary header navigation (auto-seeded with 8 items + 34 children on first activation)
  • Pages — every static page's title, excerpt, content, and (where relevant) featured image. The Service Area page has a custom "Suburb Lists" meta box; service-replacement pages have a "Vehicle Makes" meta box.
  • Products / Categories / Brands / Coupons / Orders — all standard WooCommerce admin
  • Bookings — custom CPT with status workflow (new → confirmed → dispatched → in_progress → completed / cancelled)

Project structure highlights

wp-content/themes/battery-australia/
├── style.css, functions.php
├── header.php, footer.php, index.php, page.php, single.php, 404.php
├── front-page.php                — homepage
├── page-{slug}.php                — per-page templates
├── template-service.php           — service-replacement pages
├── inc/
│   ├── site-settings.php          — Settings → Battery Australia
│   ├── service-config.php         — structural service-page config
│   ├── shop-filters.php           — sidebar filters (brand/price/chemistry/stock/sale)
│   ├── cart-drawer.php            — slide-in mini-cart + WC fragments
│   ├── product-options.php        — "Battery + Fitting" cart fee
│   ├── page-meta.php              — service-area suburbs, service-page vehicle makes
│   └── nav-menu.php               — BA_Nav_Walker + auto-seed
├── assets/css/{app.css, wc-overrides.css}
├── assets/js/{app.js, cart-drawer.js}
└── woocommerce/                   — WC template overrides
    ├── archive-product.php, single-product.php, content-*.php
    ├── loop/loop-{start,end}.php
    ├── cart/cart.php, cart/cart-empty.php
    └── checkout/{form-checkout,thankyou}.php

Local dev notes

  • wp-config.php has WP_DEBUG = true + WP_DEBUG_LOG = true. Errors go to wp-content/debug.log (gitignored).
  • Emails (booking confirmations, contact form, order receipts) use wp_mail() which calls PHP mail(). On local macOS this often fails silently — install WP Mail SMTP plugin or run a local SMTP catcher (e.g. MailHog) to actually inspect mail.
  • Cart and Checkout pages must use the legacy shortcodes [woocommerce_cart] / [woocommerce_checkout] (not the WC blocks) for our template overrides to apply.

Migration script (one-shot)

/tmp/ba-migrate.php — reads from the battery_database Laravel DB and creates: 15 product categories, 13 brands, 120 products with custom meta, 4 coupons, 9 reviews. Idempotent (safe to re-run).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages