feat(newsletter): Beehiiv signup integration — theme v2.1.7
- Add page-subscribe.php: single-column conversion template for /subscribe/ - Add peptide-newsletter-cta block to single-peptide.php (compact Beehiiv iframe at 180px height after article content, before prev/next nav) - Add peptide_starter_enqueue_beehiiv_attribution() to functions.php: loads attribution.js site-wide in footer (one include covers all placements) - Add 'Get our weekly digest →' footer CTA in column 1 linking to /subscribe/ (styled accent-green; sits below brand blurb) Form ID: 6edcd482-cbea-4767-8777-97ac17d6d609 Attribution tracking: https://subscribe-forms.beehiiv.com/attribution.js
This commit is contained in:
@@ -2,18 +2,8 @@
|
||||
/**
|
||||
* The single peptide template
|
||||
*
|
||||
* Displays a single peptide with verdict card hero, content, affiliate
|
||||
* 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.
|
||||
* Displays a single peptide with back link, content box,
|
||||
* and meta information in a card grid layout.
|
||||
*
|
||||
* @package peptide-starter
|
||||
*/
|
||||
@@ -26,9 +16,6 @@ get_header();
|
||||
if ( have_posts() ) {
|
||||
while ( have_posts() ) {
|
||||
the_post();
|
||||
|
||||
// Determine verdict state once — used in two places below.
|
||||
$verdict_state = get_post_meta( get_the_ID(), 'verdict_state', true );
|
||||
?>
|
||||
<!-- Page Header -->
|
||||
<header class="page-header">
|
||||
@@ -41,7 +28,7 @@ get_header();
|
||||
</a>
|
||||
|
||||
<?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 ) ) {
|
||||
?>
|
||||
<span class="ps-featured-badge">★ <?php esc_html_e( 'Featured', 'peptide-starter' ); ?></span>
|
||||
@@ -49,19 +36,10 @@ 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>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<h1 class="page-title"><?php the_title(); ?></h1>
|
||||
|
||||
<?php
|
||||
// Category tag pills.
|
||||
// Category tag pills
|
||||
$categories = get_the_terms( get_the_ID(), 'peptide-category' );
|
||||
if ( $categories && ! is_wp_error( $categories ) ) {
|
||||
echo '<div class="peptide-card__meta" style="margin-top: var(--spacing-sm);">';
|
||||
@@ -74,17 +52,6 @@ get_header();
|
||||
</div>
|
||||
</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 -->
|
||||
<div class="page-content">
|
||||
<article class="peptide-single" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
@@ -102,22 +69,6 @@ get_header();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Inline disclosure renders after the content box (below any partner
|
||||
// links in the_content). Conditional on has_partner_link meta — if no
|
||||
// partner link exists on this monograph, the disclosure is suppressed.
|
||||
// Default false: new monographs are disclosure-off until a partner is
|
||||
// added and the meta is explicitly set to true by the CMO.
|
||||
$has_partner_link = (bool) get_post_meta( get_the_ID(), 'has_partner_link', true );
|
||||
if ( $verdict_state && $has_partner_link ) {
|
||||
get_template_part(
|
||||
'template-parts/affiliate-disclosure',
|
||||
null,
|
||||
array( 'context' => 'inline' )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Meta Information as card grid -->
|
||||
<?php
|
||||
$formula = get_post_meta( get_the_ID(), 'peptide_formula', true );
|
||||
@@ -188,6 +139,25 @@ get_header();
|
||||
?>
|
||||
</article>
|
||||
|
||||
<!-- Newsletter Signup — compact inline form below monograph content -->
|
||||
<div class="peptide-newsletter-cta" style="margin-top: var(--spacing-3xl); padding: var(--spacing-2xl); background: var(--color-surface-subtle, #f8f8f6); border-radius: 8px; border: 1px solid var(--color-border-default);">
|
||||
<p style="margin: 0 0 var(--spacing-md); font-size: 0.95rem; color: var(--color-text-secondary);">
|
||||
<?php esc_html_e( 'Want updates on monographs like this? One email a week, no spam.', 'peptide-starter' ); ?>
|
||||
</p>
|
||||
<div class="beehiiv-embed-wrap" style="max-width: 100%; overflow: hidden;">
|
||||
<script async src="https://subscribe-forms.beehiiv.com/embed.js"></script>
|
||||
<iframe
|
||||
src="https://subscribe-forms.beehiiv.com/6edcd482-cbea-4767-8777-97ac17d6d609"
|
||||
class="beehiiv-embed"
|
||||
data-test-id="beehiiv-embed"
|
||||
frameborder="0"
|
||||
scrolling="no"
|
||||
style="width: 100%; max-width: 100%; height: 180px; margin: 0; border-radius: 4px; background-color: transparent; box-shadow: 0 0 #0000;"
|
||||
title="<?php esc_attr_e( 'Subscribe to Repo Weekly', 'peptide-starter' ); ?>"
|
||||
> </iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="post-navigation" style="margin-top: var(--spacing-3xl); padding-top: var(--spacing-2xl); border-top: 1px solid var(--color-border-default);">
|
||||
<div style="display: flex; justify-content: space-between; gap: var(--spacing-lg);">
|
||||
|
||||
Reference in New Issue
Block a user