From 16ae33a2a662c6b1ea201b587c7e7d555e973b17 Mon Sep 17 00:00:00 2001 From: Taavi Pertman Date: Fri, 14 Aug 2026 15:14:21 +0300 Subject: [PATCH 1/2] Make the CO2 intensity figure settable per fund page TUK75, TUK00 and TUV100 carried the figure as a literal in the markup, so every quarterly update meant a commit and a deploy. Add fund_co2_intensity to the pension pages under the same name TKF100 already uses, with the current figure as the fallback, so one field name serves all four funds. The field is text rather than number because trailing zeros are significant: TUK00's 133.80 renders as 133.8 once it becomes a float, which is why that one literal was already quoted and the other two were not. Enable show_in_rest on group_fund_savings_details too, so TKF100's existing field can be written the same way. TKF100 has no CO2 figure and the savings template hides the block while the field is empty, so that stays inert until a value exists. Co-Authored-By: Claude Opus 5 (1M context) --- .../tuleva/helpers/acf/fund-pension.php | 48 +++++++++++++++++++ .../tuleva/helpers/acf/fund-savings.php | 4 ++ .../components/fund-bonds-details.php | 5 +- .../components/fund-stocks-details.php | 5 +- .../components/fund-third-details.php | 5 +- 5 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/wp-content/themes/tuleva/helpers/acf/fund-pension.php b/src/wp-content/themes/tuleva/helpers/acf/fund-pension.php index b3b47a31..35e1ebfc 100644 --- a/src/wp-content/themes/tuleva/helpers/acf/fund-pension.php +++ b/src/wp-content/themes/tuleva/helpers/acf/fund-pension.php @@ -52,4 +52,52 @@ 'show_in_rest' => 1, )); +acf_add_local_field_group(array ( + 'key' => 'group_fund_pension_sustainability', + 'title' => 'Sustainability', + 'fields' => array ( + array ( + 'key' => 'field_fund_pension_co2_intensity', + 'label' => 'CO2 Intensity', + 'name' => 'fund_co2_intensity', + // Text, not number: the figure is rendered verbatim and trailing zeros are + // significant ("133.80" must not collapse to "133.8"). Matches TKF100's field. + 'type' => 'text', + 'instructions' => 'CO2 intensity value (number only, e.g. "83.68"). When set, this replaces the hardcoded figure in the template.', + 'required' => 0, + ), + ), + 'location' => array ( + array ( + array ( + 'param' => 'page_template', + 'operator' => '==', + 'value' => 'page_fund-stocks.php', + ), + ), + array ( + array ( + 'param' => 'page_template', + 'operator' => '==', + 'value' => 'page_fund-bonds.php', + ), + ), + array ( + array ( + 'param' => 'page_template', + 'operator' => '==', + 'value' => 'page_fund-third.php', + ), + ), + ), + 'menu_order' => 11, + 'position' => 'normal', + 'style' => 'default', + 'label_placement' => 'top', + 'instruction_placement' => 'label', + 'active' => 1, + // Same REST requirement as the investment report group above. + 'show_in_rest' => 1, +)); + endif; diff --git a/src/wp-content/themes/tuleva/helpers/acf/fund-savings.php b/src/wp-content/themes/tuleva/helpers/acf/fund-savings.php index fe45c582..b9ad0b09 100644 --- a/src/wp-content/themes/tuleva/helpers/acf/fund-savings.php +++ b/src/wp-content/themes/tuleva/helpers/acf/fund-savings.php @@ -176,6 +176,10 @@ 'label_placement' => 'top', 'instruction_placement' => 'label', 'active' => 1, + // Lets fund_co2_intensity be set over the REST API, the same way the pension funds' + // field is. TKF100 has no CO2 figure yet; the template hides the whole block while the + // field is empty, so this stays inert until someone supplies a value. + 'show_in_rest' => 1, )); // Documents fields diff --git a/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php b/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php index 0d14738f..bec7d195 100644 --- a/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php +++ b/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php @@ -95,7 +95,10 @@

- +

diff --git a/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php b/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php index 5a133b4b..52d584ab 100644 --- a/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php +++ b/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php @@ -94,7 +94,10 @@

- +

diff --git a/src/wp-content/themes/tuleva/templates/components/fund-third-details.php b/src/wp-content/themes/tuleva/templates/components/fund-third-details.php index 4f7d2f39..5fa69444 100644 --- a/src/wp-content/themes/tuleva/templates/components/fund-third-details.php +++ b/src/wp-content/themes/tuleva/templates/components/fund-third-details.php @@ -94,7 +94,10 @@

- +

From db8a36ca4c008b075015066478016037228a69e1 Mon Sep 17 00:00:00 2001 From: Taavi Pertman Date: Mon, 17 Aug 2026 10:07:38 +0300 Subject: [PATCH 2/2] Say which of the two CO2 figures actually renders The fallback literal has to stay -- it is what the page shows until someone fills the field in -- but it also creates a second place the number can live, and the field silently wins. The quarterly WACI update has been "edit these three files" until now, so the next person to follow that habit on a fund whose field is already set would change nothing and have no way to notice. Comment only, no behaviour change. Co-Authored-By: Claude Opus 5 (1M context) --- .../tuleva/templates/components/fund-bonds-details.php | 5 +++++ .../tuleva/templates/components/fund-stocks-details.php | 5 +++++ .../tuleva/templates/components/fund-third-details.php | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php b/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php index bec7d195..ec05ee2d 100644 --- a/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php +++ b/src/wp-content/themes/tuleva/templates/components/fund-bonds-details.php @@ -96,6 +96,11 @@

diff --git a/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php b/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php index 52d584ab..ee1a0fcb 100644 --- a/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php +++ b/src/wp-content/themes/tuleva/templates/components/fund-stocks-details.php @@ -95,6 +95,11 @@

diff --git a/src/wp-content/themes/tuleva/templates/components/fund-third-details.php b/src/wp-content/themes/tuleva/templates/components/fund-third-details.php index 5fa69444..11d65174 100644 --- a/src/wp-content/themes/tuleva/templates/components/fund-third-details.php +++ b/src/wp-content/themes/tuleva/templates/components/fund-third-details.php @@ -95,6 +95,11 @@