Project Scope: Zip Code to Politician Email Feature

Status: Implemented - Campaign button approach Created: 2026-01-15 Updated: 2026-01-19

Overview

Add a zip code field to the Break Ground Now pledge form. When users provide a Solano County zip code, the thank you page displays a campaign button that links to an external campaign portal where they can email their elected officials.

Key Change (2026-01-19): Originally designed with copy-to-clipboard email fields. Client requested we use their external campaign service instead, so the implementation now uses a single button linking to campaign_url.

Current Implementation

Thank You Page Versions

Condition Version What's Shown
Zip in Solano County (17 zips) IN-ZIP Hero + Quote form + Campaign button + Share + Journey
Zip NOT in Solano County OUT-OF-ZIP Simplified hero with share buttons only

Politician Map Structure

Located in page-thank-you.php, the $politician_map array contains 17 Solano County zip codes:

$politician_map = array(
    '94510' => array(
        'name'         => 'Senator Maria Gonzalez',      // Placeholder
        'email'        => 'maria.gonzalez@fake-senate.ca.gov',  // Placeholder
        'title'        => 'State Senator, District 3',   // Placeholder
        'city'         => 'Benicia',                     // Used for display
        'campaign_url' => '#',                           // External campaign URL (TBD)
    ),
    // ... 16 more Solano zips
);

Solano County Zips: 94510, 94512, 94533, 94534, 94535, 94571, 94585, 94589, 94590, 94591, 94592, 95620, 95625, 95687, 95688, 95690, 95694

Campaign Button (Right Column)

<div class="take-action-wrapper">
    <h3>Take the next step</h3>
    <p>Let your local electeds know that you support breaking ground now
       with well paid jobs, affordable homes, and new investment in Solano County.</p>

    <a href="<?php echo esc_url( $politician['campaign_url'] ); ?>"
       class="btn" target="_blank" rel="noopener noreferrer">
        Email them now
        <i class="fa-sharp fa-solid fa-arrow-right ml-2"></i>
    </a>
</div>

Debug Indicator (Logged-in Only)

When logged into WordPress, a small badge appears next to the button showing:

ZIP: 94510 → Benicia

This helps verify the correct zip code routing during testing.

Files

File Purpose
page-thank-you.php Main template with politician map and campaign button
inc/modules/archive/thank-you-email-copy-form.php Archived original email copy form (for reference)
content-import/test-thank-you-zip-routing.php Test script for zip routing (15 test cases)
CLAUDE.md Theme documentation (see "Thank You Page" section)

Testing

Run the test script:

./wp-cli.sh eval-file wp-content/themes/california-forever/content-import/test-thank-you-zip-routing.php

Manual test URLs: - IN-ZIP: /breakgroundnow/thank-you/?zip=94510 (Benicia) - IN-ZIP: /breakgroundnow/thank-you/?zip=94533 (Fairfield) - OUT-OF-ZIP: /breakgroundnow/thank-you/?zip=90210 (Beverly Hills) - OUT-OF-ZIP: /breakgroundnow/thank-you/?zip=10001 (NYC)

Waiting on Client

  1. Campaign URLs: Real external campaign portal URLs for campaign_url field - May be one URL for all Solano zips, or different URLs per city/region
  2. Politician data: If they want to display politician names in the future

Archived: Original Email Copy Approach

The original implementation used copy-to-clipboard fields for To, Subject, and Body. This code is preserved in:

inc/modules/archive/thank-you-email-copy-form.php

The JavaScript for copy buttons is still in page-thank-you.php but inactive since the buttons no longer exist.


Historical: Original Requirements (Superseded)

Click to expand original spec (for reference only) ### Original Faux Email UI Design
┌─────────────────────────────────────────────────┐
│ Take the next step — email your representative  │
├─────────────────────────────────────────────────┤
│ To:      senator.smith@senate.gov    [Copy]     │
│ From:    (your email address)        [Copy]     │
│ Subject: Support California Forever  [Copy]     │
│ Message: ─────────────────────────── [Copy]     │
│          Dear Senator Smith,                    │
│          I am writing to express...             │
│          ...                                    │
└─────────────────────────────────────────────────┘
### Original Requirements - Copy method: Individual copy buttons per field (no mailto) - Fields: To, From, Subject, Message - Users copy each field and paste into their email client This approach was replaced with the campaign button on 2026-01-19 per client request.