HEX
Server: Apache/2.4.66 (Debian)
System: Linux 6dfabc3b2241 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User: (1000)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /var/www/html/populate-support-cae.php
<?php
/**
 * Populate Support CAE page with Figma content.
 * Run via: docker compose run --rm wpcli eval-file /var/www/html/wp-content/themes/custom-theme/../../scripts/populate-support-cae.php
 * Or copy to a path accessible to wp-cli and eval-file it.
 *
 * Content source: Figma node 19268:574309 (Ways to Give 1440)
 */

$post_id = 25; // Support CAE page

// Build block data for support-cae
$support_cae_data = [
    // Tabs
    'support_cae_tabs' => 2,
    '_support_cae_tabs' => 'field_support_cae_tabs',
    'support_cae_tabs_0_tab_label' => 'Donate',
    '_support_cae_tabs_0_tab_label' => 'field_support_cae_tab_label',
    'support_cae_tabs_0_tab_link' => ['title' => 'Donate', 'url' => '/support-cae#donate', 'target' => ''],
    '_support_cae_tabs_0_tab_link' => 'field_support_cae_tab_link',
    'support_cae_tabs_0_tab_active' => 0,
    '_support_cae_tabs_0_tab_active' => 'field_support_cae_tab_active',
    'support_cae_tabs_1_tab_label' => 'Ways to Give',
    '_support_cae_tabs_1_tab_label' => 'field_support_cae_tab_label',
    'support_cae_tabs_1_tab_link' => ['title' => 'Ways to Give', 'url' => '/support-cae', 'target' => ''],
    '_support_cae_tabs_1_tab_link' => 'field_support_cae_tab_link',
    'support_cae_tabs_1_tab_active' => 1,
    '_support_cae_tabs_1_tab_active' => 'field_support_cae_tab_active',

    // Intro
    'support_cae_intro_heading' => "SUPPORTING VERMONT'S FARMS, FOOD, AND COMMUNITIES",
    '_support_cae_intro_heading' => 'field_support_cae_intro_heading',
    'support_cae_intro_description' => "The farms, food businesses, and communities that CAE works with are an integral part of what makes Vermont, \"Vermont\". They are responsible for everything from the picturesque views to the delicious food on your dinner plate. CAE is committed to supporting them and can only do so with support from you.",
    '_support_cae_intro_description' => 'field_support_cae_intro_description',

    // Accordion items (6 total)
    'support_cae_items' => 6,
    '_support_cae_items' => 'field_support_cae_items',
];

// Item titles and descriptions from Figma (placeholder for most)
$placeholder_title = 'Give a Gift of Cash';
$placeholder_desc = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequation filla de liqua.';

$items = [
    [
        'title' => 'Give a Gift of Cash',
        'desc' => $placeholder_desc,
        'type' => 'accordion',
        'content' => '<p>Cash gifts are the simplest way to support CAE. You can make a one-time gift or set up a recurring donation to provide ongoing support for our programs and services.</p>',
    ],
    [
        'title' => 'Donor Advised Funds',
        'desc' => $placeholder_desc,
        'type' => 'accordion',
        'content' => '<p>If you have a Donor Advised Fund (DAF), you can recommend a grant to the Center for an Agricultural Economy. Contact your DAF administrator to initiate the gift.</p>',
    ],
    [
        'title' => 'Give a Gift of Stock',
        'desc' => $placeholder_desc,
        'type' => 'accordion',
        'content' => "<p>As a result, you may be able to take a tax deduction for full fair market value and you won't have to pay capital gains tax if you've held the stock for more than a year. Generally, stocks are transitioned into cash upon receipt. CAE's brokerage account is with Edward Jones. You will need to share the following information with your broker to initiate the transfer:</p>",
        'details' => [
            ['label' => 'FBO', 'value' => 'FBO'],
            ['label' => 'Account #', 'value' => '95126065'],
            ['label' => 'DTC #', 'value' => '0057'],
            ["label" => "CAE's Tax ID Number", 'value' => '57-1201683'],
        ],
        'callout_heading' => 'AFTER YOU DONATE STOCK',
        'callout_description' => "<p>Let us know! Names are not included in the transfer of stock so if you or your broker don't alert us to the gift, we won't know who to thank. Please contact Becca with any questions.</p>",
    ],
    [
        'title' => 'Planned Giving & Bequests',
        'desc' => $placeholder_desc,
        'type' => 'accordion',
        'content' => '<p>Including CAE in your estate plan is a meaningful way to ensure the long-term sustainability of our work in supporting Vermont farms and communities.</p>',
    ],
    [
        'title' => 'Matching Gifts',
        'desc' => $placeholder_desc,
        'type' => 'accordion',
        'content' => '<p>Many employers match charitable contributions made by their employees. Check with your employer to see if they offer a matching gift program to double your impact.</p>',
    ],
    [
        'title' => 'In-Kind Donations',
        'desc' => $placeholder_desc,
        'type' => 'accordion',
        'content' => '<p>CAE accepts in-kind donations of goods and services that support our mission. Contact us to discuss how your contribution can make a difference.</p>',
    ],
];

foreach ($items as $i => $item) {
    $support_cae_data["support_cae_items_{$i}_item_title"] = $item['title'];
    $support_cae_data["_support_cae_items_{$i}_item_title"] = 'field_support_cae_item_title';
    $support_cae_data["support_cae_items_{$i}_item_description"] = $item['desc'];
    $support_cae_data["_support_cae_items_{$i}_item_description"] = 'field_support_cae_item_description';
    $support_cae_data["support_cae_items_{$i}_item_type"] = $item['type'];
    $support_cae_data["_support_cae_items_{$i}_item_type"] = 'field_support_cae_item_type';

    if (!empty($item['content'])) {
        $support_cae_data["support_cae_items_{$i}_item_content"] = $item['content'];
        $support_cae_data["_support_cae_items_{$i}_item_content"] = 'field_support_cae_item_content';
    }

    if (!empty($item['details'])) {
        $support_cae_data["support_cae_items_{$i}_item_details"] = count($item['details']);
        $support_cae_data["_support_cae_items_{$i}_item_details"] = 'field_support_cae_item_details';
        foreach ($item['details'] as $j => $detail) {
            $support_cae_data["support_cae_items_{$i}_item_details_{$j}_detail_label"] = $detail['label'];
            $support_cae_data["_support_cae_items_{$i}_item_details_{$j}_detail_label"] = 'field_support_cae_detail_label';
            $support_cae_data["support_cae_items_{$i}_item_details_{$j}_detail_value"] = $detail['value'];
            $support_cae_data["_support_cae_items_{$i}_item_details_{$j}_detail_value"] = 'field_support_cae_detail_value';
        }
    }

    if (!empty($item['callout_heading'])) {
        $support_cae_data["support_cae_items_{$i}_item_callout_heading"] = $item['callout_heading'];
        $support_cae_data["_support_cae_items_{$i}_item_callout_heading"] = 'field_support_cae_item_callout_heading';
    }
    if (!empty($item['callout_description'])) {
        $support_cae_data["support_cae_items_{$i}_item_callout_description"] = $item['callout_description'];
        $support_cae_data["_support_cae_items_{$i}_item_callout_description"] = 'field_support_cae_item_callout_description';
    }
}

// Build CTA block data
$cta_data = [
    'cta_heading' => 'GET INVOLVED',
    '_cta_heading' => 'field_cta_heading',
    'cta_description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco',
    '_cta_description' => 'field_cta_description',
    'cta_button' => ['title' => 'Contact Us', 'url' => '/contact-us', 'target' => ''],
    '_cta_button' => 'field_cta_button',
];

// Build post content with both blocks
$support_block = '<!-- wp:acf/support-cae ' . json_encode([
    'name' => 'acf/support-cae',
    'data' => $support_cae_data,
    'mode' => 'preview',
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ' /-->';

$cta_block = '<!-- wp:acf/cta ' . json_encode([
    'name' => 'acf/cta',
    'data' => $cta_data,
    'mode' => 'preview',
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ' /-->';

$post_content = $support_block . "\n\n" . $cta_block;

// Update the post
$result = wp_update_post([
    'ID' => $post_id,
    'post_content' => $post_content,
], true);

if (is_wp_error($result)) {
    WP_CLI::error('Failed to update post: ' . $result->get_error_message());
} else {
    WP_CLI::success("Support CAE page (ID {$post_id}) updated with Figma content.");
    WP_CLI::log("  - support-cae block: 2 tabs, intro section, 6 accordion items");
    WP_CLI::log("  - cta block: GET INVOLVED heading, Contact Us button");
}