File: //proc/thread-self/cwd/populate-support-cae-v2.php
<?php
/**
* Populate Support CAE page — v2, using post meta instead of inline block data.
* ACF reads from post meta when block attrs don't contain data.
*/
$post_id = 25;
// Set simple block markup (no inline data)
$post_content = '<!-- wp:acf/support-cae {"name":"acf/support-cae","mode":"preview"} /-->' . "\n\n" .
'<!-- wp:acf/cta {"name":"acf/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.","_cta_description":"field_cta_description","cta_button":{"title":"Contact Us","url":"/contact-us","target":""},"_cta_button":"field_cta_button"},"mode":"preview"} /-->';
wp_update_post(['ID' => $post_id, 'post_content' => $post_content]);
// Now populate via ACF's update_field (stores in post meta)
// Tabs
update_field('support_cae_tabs', [
[
'tab_label' => 'Donate',
'tab_link' => ['title' => 'Donate', 'url' => '/support-cae#donate', 'target' => ''],
'tab_active' => false,
],
[
'tab_label' => 'Ways to Give',
'tab_link' => ['title' => 'Ways to Give', 'url' => '/support-cae', 'target' => ''],
'tab_active' => true,
],
], $post_id);
// Intro
update_field('support_cae_intro_heading', "SUPPORTING VERMONT'S FARMS, FOOD, AND COMMUNITIES", $post_id);
update_field('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.", $post_id);
// Accordion items
$items = [
[
'item_title' => 'Give a Gift of Cash',
'item_description' => 'Make a tax-deductible donation to support CAE\'s work in strengthening Vermont\'s farms, food businesses, and communities.',
'item_type' => 'accordion',
'item_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>',
],
[
'item_title' => 'Donor Advised Funds',
'item_description' => 'Recommend a grant from your Donor Advised Fund to support Vermont\'s agricultural economy and rural communities.',
'item_type' => 'accordion',
'item_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>',
],
[
'item_title' => 'Give a Gift of Stock',
'item_description' => 'Donating appreciated securities can provide significant tax benefits while supporting CAE\'s mission.',
'item_type' => 'accordion',
'item_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>',
'item_details' => [
['detail_label' => 'FBO', 'detail_value' => 'FBO'],
['detail_label' => 'Account #', 'detail_value' => '95126065'],
['detail_label' => 'DTC #', 'detail_value' => '0057'],
['detail_label' => "CAE's Tax ID Number", 'detail_value' => '57-1201683'],
],
'item_callout_heading' => 'AFTER YOU DONATE STOCK',
'item_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>',
],
[
'item_title' => 'Planned Giving & Bequests',
'item_description' => 'Include CAE in your estate plan to ensure the long-term sustainability of our work in Vermont.',
'item_type' => 'accordion',
'item_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>',
],
[
'item_title' => 'Matching Gifts',
'item_description' => 'Double your impact through your employer\'s matching gift program.',
'item_type' => 'accordion',
'item_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>',
],
[
'item_title' => 'In-Kind Donations',
'item_description' => 'Contribute goods and services that directly support CAE\'s programs and mission.',
'item_type' => 'accordion',
'item_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>',
],
];
update_field('support_cae_items', $items, $post_id);
// Verify
$heading = get_field('support_cae_intro_heading', $post_id);
$items_check = get_field('support_cae_items', $post_id);
$tabs_check = get_field('support_cae_tabs', $post_id);
WP_CLI::success("Support CAE page populated via post meta.");
WP_CLI::log(" Heading: " . ($heading ?: 'MISSING'));
WP_CLI::log(" Tabs: " . (is_array($tabs_check) ? count($tabs_check) : 'MISSING'));
WP_CLI::log(" Items: " . (is_array($items_check) ? count($items_check) : 'MISSING'));