From 3942c6b29e0526feb73f468fc12d6df767169073 Mon Sep 17 00:00:00 2001
From: peptiderepo
Date: Sun, 26 Apr 2026 04:26:59 +0000
Subject: [PATCH] =?UTF-8?q?v2.1.0=20fix=20=E2=80=94=20tabs,=20split=20verd?=
=?UTF-8?q?ict=20helpers,=20PHPCS=20clean?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Convert space indentation → tabs in front-page.php (PHPCS)
- Extract verdict taxonomy + config arrays → inc/verdict-helpers.php
- Wire verdict-helpers.php into functions.php
- front-page.php now 254 lines (was 309)
---
front-page.php | 51 +++--------------------
functions.php | 1 +
inc/verdict-helpers.php | 90 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+), 45 deletions(-)
create mode 100644 inc/verdict-helpers.php
diff --git a/front-page.php b/front-page.php
index 12ac7b9..a9c5812 100644
--- a/front-page.php
+++ b/front-page.php
@@ -20,42 +20,8 @@
get_header();
-/**
- * Verdict taxonomy data for the homepage explainer strip.
- * Canonical order matches CMO brief §5.1 and the 5-state enum in verdict-meta.php.
- */
-$verdict_taxonomy = array(
- array(
- 'state' => 'established',
- 'glyph' => '✓',
- 'label' => 'Established',
- 'description' => 'Strong RCT evidence; widely prescribed or validated.',
- ),
- array(
- 'state' => 'promising',
- 'glyph' => '◐',
- 'label' => 'Promising',
- 'description' => 'Meaningful human data accumulating; not yet RCT-strong.',
- ),
- array(
- 'state' => 'investigational',
- 'glyph' => '?',
- 'label' => 'Investigational',
- 'description' => 'Mechanism plausible; human trials sparse.',
- ),
- array(
- 'state' => 'insufficient',
- 'glyph' => '⊘',
- 'label' => 'Insufficient Evidence',
- 'description' => 'Not enough data to say anything responsible.',
- ),
- array(
- 'state' => 'cautionary',
- 'glyph' => '⚠',
- 'label' => 'Cautionary',
- 'description' => 'Active safety signals or misuse patterns.',
- ),
-);
+/** @see inc/verdict-helpers.php — peptide_starter_get_verdict_taxonomy() */
+$verdict_taxonomy = peptide_starter_get_verdict_taxonomy();
/**
* Featured monograph post IDs. These are the three exemplar monographs
@@ -183,20 +149,15 @@ $featured_monograph_ids = array( 211, 36, 177 );
- ID;
$verdict_state = get_post_meta( $post_id, 'verdict_state', true );
$verdict_text = get_post_meta( $post_id, 'verdict_text', true );
$post_url = get_permalink( $post_id );
- // Verdict state config (mirrors badge.php logic).
- $verdict_config = array(
- 'established' => array( 'glyph' => '✓', 'label' => 'Established' ),
- 'promising' => array( 'glyph' => '◐', 'label' => 'Promising' ),
- 'investigational'=> array( 'glyph' => '?', 'label' => 'Investigational' ),
- 'insufficient' => array( 'glyph' => '⊘', 'label' => 'Insufficient Evidence' ),
- 'cautionary' => array( 'glyph' => '⚠', 'label' => 'Cautionary' ),
- );
+ // Verdict state config — @see inc/verdict-helpers.php
+ $verdict_config = peptide_starter_get_verdict_config();
$vc = isset( $verdict_config[ $verdict_state ] ) ? $verdict_config[ $verdict_state ] : null;
// Signal rows (up to 3).
diff --git a/functions.php b/functions.php
index fc7f54c..67f3279 100644
--- a/functions.php
+++ b/functions.php
@@ -45,6 +45,7 @@ require_once PEPTIDE_STARTER_DIR . '/inc/newsletter-admin.php';
require_once PEPTIDE_STARTER_DIR . '/inc/mail-diagnostic.php';
require_once PEPTIDE_STARTER_DIR . '/inc/perf-asset-policy.php';
require_once PEPTIDE_STARTER_DIR . '/inc/verdict-meta.php';
+require_once PEPTIDE_STARTER_DIR . '/inc/verdict-helpers.php';
/**
* Set up theme defaults and register support for WordPress features.
diff --git a/inc/verdict-helpers.php b/inc/verdict-helpers.php
new file mode 100644
index 0000000..7013d5d
--- /dev/null
+++ b/inc/verdict-helpers.php
@@ -0,0 +1,90 @@
+ 'established',
+ 'glyph' => '✓',
+ 'label' => 'Established',
+ 'description' => 'Strong RCT evidence; widely prescribed or validated.',
+ ),
+ array(
+ 'state' => 'promising',
+ 'glyph' => '◐',
+ 'label' => 'Promising',
+ 'description' => 'Meaningful human data accumulating; not yet RCT-strong.',
+ ),
+ array(
+ 'state' => 'investigational',
+ 'glyph' => '?',
+ 'label' => 'Investigational',
+ 'description' => 'Mechanism plausible; human trials sparse.',
+ ),
+ array(
+ 'state' => 'insufficient',
+ 'glyph' => '⊘',
+ 'label' => 'Insufficient Evidence',
+ 'description' => 'Not enough data to say anything responsible.',
+ ),
+ array(
+ 'state' => 'cautionary',
+ 'glyph' => '⚠',
+ 'label' => 'Cautionary',
+ 'description' => 'Active safety signals or misuse patterns.',
+ ),
+ );
+}
+
+/**
+ * Returns the verdict state config map (glyph + label per state slug).
+ *
+ * Used by featured verdict cards on the homepage and any template that needs
+ * to render a verdict badge from a state string without loading the full card.
+ *
+ * @return array Keyed by state slug. Each value: array{ glyph: string, label: string }.
+ */
+function peptide_starter_get_verdict_config() {
+ return array(
+ 'established' => array(
+ 'glyph' => '✓',
+ 'label' => 'Established',
+ ),
+ 'promising' => array(
+ 'glyph' => '◐',
+ 'label' => 'Promising',
+ ),
+ 'investigational' => array(
+ 'glyph' => '?',
+ 'label' => 'Investigational',
+ ),
+ 'insufficient' => array(
+ 'glyph' => '⊘',
+ 'label' => 'Insufficient Evidence',
+ ),
+ 'cautionary' => array(
+ 'glyph' => '⚠',
+ 'label' => 'Cautionary',
+ ),
+ );
+}