fix: wire verdict card and disclosure into single-peptide.php (v2.0.0-alpha.2)

- Verdict card component was built in alpha.1 but never called from the
  template; no verdict state was rendering on any pr_peptide page.
  Now called immediately after the page header for posts with verdict_state.
- Affiliate disclosure (inline) was built in alpha.1 but never called.
  Now rendered after .peptide-content-box (below the_content / partner links)
  per the editorial disclosure spec: disclosure must follow the partner link.
- Suppress page-header <h1> when verdict_state is set; the verdict card
  already renders an <h1>, avoiding duplicate heading semantics / SEO issue.
This commit is contained in:
peptiderepo
2026-04-25 20:28:14 +00:00
parent 4f16ed9035
commit ce08425270
4 changed files with 70 additions and 7 deletions

View File

@@ -1,5 +1,21 @@
# Peptide Starter Theme - Changelog # Peptide Starter Theme - Changelog
## [2.0.0-alpha.2] - 2026-04-26 — Wire verdict card and disclosure into single-peptide.php
### Fixed
- `single-peptide.php`: Verdict card component was created in alpha.1 but never called
from the template — no verdict state was rendering on any peptide page. Now called
immediately after the page header for all `pr_peptide` posts with a `verdict_state`.
- `single-peptide.php`: Affiliate disclosure (inline context) was created in alpha.1 but
never called. Now rendered directly after the content box (below `the_content()`),
ensuring it appears below any partner links in the post body per the editorial
disclosure spec.
- `single-peptide.php`: Duplicate `<h1>` issue — the page header was rendering an H1
title AND the verdict card was also rendering an H1. Fixed: page header H1 is now
suppressed when a `verdict_state` is set; the verdict card owns the H1 for monograph
posts.
All notable changes to the Peptide Starter Theme are documented in this file. All notable changes to the Peptide Starter Theme are documented in this file.
## [2.0.0-alpha.1] - 2026-04-26 — Brand Identity v1.0.0 (Direction C: Trusted Guide) ## [2.0.0-alpha.1] - 2026-04-26 — Brand Identity v1.0.0 (Direction C: Trusted Guide)

View File

@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
// Theme constants. // Theme constants.
define( 'PEPTIDE_STARTER_VERSION', '2.0.0-alpha.1' ); define( 'PEPTIDE_STARTER_VERSION', '2.0.0-alpha.2' );
define( 'PEPTIDE_STARTER_DIR', get_template_directory() ); define( 'PEPTIDE_STARTER_DIR', get_template_directory() );
define( 'PEPTIDE_STARTER_URI', get_template_directory_uri() ); define( 'PEPTIDE_STARTER_URI', get_template_directory_uri() );

View File

@@ -2,8 +2,18 @@
/** /**
* The single peptide template * The single peptide template
* *
* Displays a single peptide with back link, content box, * Displays a single peptide with verdict card hero, content, affiliate
* and meta information in a card grid layout. * disclosure, and meta properties in a card grid layout.
*
* When a verdict_state is set on the post, the verdict card owns the <h1>
* title so the page-header section only renders the back-link and category
* pills (no duplicate heading). When no verdict state exists the classic <h1>
* renders in the header for backwards compatibility with non-monograph posts.
*
* Who calls it: WordPress template hierarchy for the pr_peptide CPT.
* Depends on: inc/verdict-meta.php (post meta registration),
* template-parts/verdict/card.php,
* template-parts/affiliate-disclosure.php.
* *
* @package peptide-starter * @package peptide-starter
*/ */
@@ -16,6 +26,9 @@ get_header();
if ( have_posts() ) { if ( have_posts() ) {
while ( have_posts() ) { while ( have_posts() ) {
the_post(); the_post();
// Determine verdict state once — used in two places below.
$verdict_state = get_post_meta( get_the_ID(), 'verdict_state', true );
?> ?>
<!-- Page Header --> <!-- Page Header -->
<header class="page-header"> <header class="page-header">
@@ -28,7 +41,7 @@ get_header();
</a> </a>
<?php <?php
// Show featured badge if the peptide is marked as featured // Show featured badge if the peptide is marked as featured.
if ( is_sticky() || get_post_meta( get_the_ID(), 'peptide_featured', true ) ) { if ( is_sticky() || get_post_meta( get_the_ID(), 'peptide_featured', true ) ) {
?> ?>
<span class="ps-featured-badge">&#9733; <?php esc_html_e( 'Featured', 'peptide-starter' ); ?></span> <span class="ps-featured-badge">&#9733; <?php esc_html_e( 'Featured', 'peptide-starter' ); ?></span>
@@ -36,10 +49,19 @@ get_header();
} }
?> ?>
<?php
// Only render the page-level <h1> when no verdict card is present.
// The verdict card component owns the <h1> for monograph posts so
// that readers encounter a single, semantically correct heading.
if ( empty( $verdict_state ) ) {
?>
<h1 class="page-title"><?php the_title(); ?></h1> <h1 class="page-title"><?php the_title(); ?></h1>
<?php
}
?>
<?php <?php
// Category tag pills // Category tag pills.
$categories = get_the_terms( get_the_ID(), 'peptide-category' ); $categories = get_the_terms( get_the_ID(), 'peptide-category' );
if ( $categories && ! is_wp_error( $categories ) ) { if ( $categories && ! is_wp_error( $categories ) ) {
echo '<div class="peptide-card__meta" style="margin-top: var(--spacing-sm);">'; echo '<div class="peptide-card__meta" style="margin-top: var(--spacing-sm);">';
@@ -52,6 +74,17 @@ get_header();
</div> </div>
</header> </header>
<!-- Verdict Card Hero (monograph posts only) -->
<?php
if ( ! empty( $verdict_state ) ) {
get_template_part(
'template-parts/verdict/card',
null,
array( 'post_id' => get_the_ID() )
);
}
?>
<!-- Single Peptide Content --> <!-- Single Peptide Content -->
<div class="page-content"> <div class="page-content">
<article class="peptide-single" id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article class="peptide-single" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@@ -69,6 +102,20 @@ get_header();
</div> </div>
</div> </div>
<?php
// Affiliate disclosure (inline) renders directly after the content
// box, which is where partner/buy links live. Per the editorial
// disclosure spec, the strip must appear below, not above, any
// partner link the reader just encountered.
if ( ! empty( $verdict_state ) ) {
get_template_part(
'template-parts/affiliate-disclosure',
null,
array( 'context' => 'inline' )
);
}
?>
<!-- Meta Information as card grid --> <!-- Meta Information as card grid -->
<?php <?php
$formula = get_post_meta( get_the_ID(), 'peptide_formula', true ); $formula = get_post_meta( get_the_ID(), 'peptide_formula', true );

View File

@@ -4,7 +4,7 @@ Theme URI: https://github.com/peptiderepo/peptide-starter
Description: Premium, accessible WordPress theme for scientific peptide reference database Description: Premium, accessible WordPress theme for scientific peptide reference database
Author: Peptide Repo Author: Peptide Repo
Author URI: https://peptiderepo.com Author URI: https://peptiderepo.com
Version: 2.0.0-alpha.1 Version: 2.0.0-alpha.2
License: GPL v2 or later License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: peptide-starter Text Domain: peptide-starter