# Promise A Future — Local WordPress

## Local URLs

- Website: http://localhost:8080/
- WordPress admin: http://localhost:8080/wp-admin/
- Mailpit inbox: http://localhost:8025/

The local administrator username is `promiseadmin`. Its development-only password is stored in the ignored `.env` file. Change it before sharing the environment.

## Start and stop

Docker Desktop must be running.

```powershell
docker compose up -d
docker compose stop
docker compose ps
```

To stop and remove containers while preserving the database and WordPress volumes:

```powershell
docker compose down
```

Do not add `--volumes` unless you intentionally want to erase the local database and WordPress installation.

## Theme development

The custom theme is in:

```text
wordpress/wp-content/themes/promise-future/
```

Theme source files are bind-mounted into the WordPress container. PHP, CSS, JavaScript, and image changes appear after reloading the browser.

Key files:

- `front-page.php`: home-page sections
- `header.php` and `footer.php`: global navigation/footer
- `inc/post-types.php`: Team, Testimonials, FAQs, Partners, Opportunities, and Programs
- `inc/forms.php`: validated Contact, Volunteer, and Partner forms
- `assets/css/site.css`: visual system and responsive layout
- `assets/js/site.js`: navigation, counters, tabs, carousel, and reveal animations

## Content editing

- Pages: **Pages**
- News and stories: **Posts**
- Staff profiles: **Team Members**
- Student quotes: **Testimonials**
- Questions: **FAQs**
- Partner organizations: **Partners**
- Volunteer roles: **Opportunities**
- Projects: **Programs**
- Submitted inquiries: **Form Submissions**

ACF is installed locally. ACF Pro should be licensed on staging/production before Pro-only option pages and repeater fields are used.

## Email testing

Local WordPress email is routed to Mailpit rather than delivered externally. Submit a form and view the message at http://localhost:8025/.

Production must replace Mailpit routing with a transactional SMTP provider and must remove or disable the local-only mail plugin through `WP_ENVIRONMENT_TYPE`.

## Donations

GiveWP is installed. Use **Donations → Forms** to create the primary donation form, then connect Stripe in test mode. Never enter live Stripe secrets or real card information into this local environment.

Before production:

1. Verify nonprofit ownership and the Stripe account.
2. Configure Stripe through GiveWP using the supported connection flow.
3. Test one-time and recurring gifts using Stripe test mode.
4. Confirm receipts, refunds, webhook delivery, and failed-payment handling.
5. Switch to live mode only after HTTPS and production backups are active.

## Backup and restore

Export the database:

```powershell
docker compose exec -T db mariadb-dump -u root -p promise_future > backup.sql
```

The root password is in `.env`. Back up both the database dump and `wp-content/uploads`. Database dumps and credentials must not be committed to Git.

For production, schedule encrypted off-server backups and perform periodic restore tests.

## Production checklist

- PHP 8.3+, MariaDB 10.11+ or MySQL 8.0+
- HTTPS with automatic certificate renewal
- Unique production database and administrator credentials
- `WP_DEBUG` disabled and `WP_ENVIRONMENT_TYPE` set to `production`
- Transactional SMTP configured and tested
- Stripe live connection and webhooks verified
- Automated off-server backups and restore test
- Caching, image optimization, security headers, rate limiting, and login protection
- Staging crawl for titles, descriptions, canonical URLs, Open Graph data, broken links, accessibility, and responsive layouts
