fix(theme): blog posts no longer fade out; readable post layout

- Scroll reveal used threshold 0.15: a section taller than ~6.7 screens (a
  long article) never reached it, so after the reveal class hid it, it
  stayed hidden. Reveal as soon as any part enters (threshold 0).
- Post header: full-width title with meta below and a normal gap
- Article: heading sizes per level, photos keep their shape (no crop),
  icon-sized inline SVGs, full-width embeds
- Strip the imported 'Home' breadcrumb line from posts and card excerpts
- Theme 1.0.15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 21:20:34 +03:30
parent d89f8c2a0b
commit 023b998694
6 changed files with 43 additions and 7 deletions

View File

@@ -35,12 +35,10 @@ body.hoho-fullwidth{overflow-x:hidden;}
/* Post body from the editor, styled like the design's .tour__block text. */
.hoho-page.hoho-page .hoho-prose{display:flex;flex-direction:column;gap:var(--sp-3);}
.hoho-page.hoho-page .hoho-prose>*{margin:0;}
.hoho-page.hoho-page .hoho-prose :is(h2,h3,h4){margin:var(--sp-3) 0 0;font-size:1rem;font-weight:700;}
.hoho-page.hoho-page .hoho-prose :is(p,li){font-size:1rem;font-weight:500;line-height:1.6;opacity:.7;}
.hoho-page.hoho-page .hoho-prose a{color:var(--c-teal);text-decoration:underline;}
.hoho-page.hoho-page .hoho-prose ul{list-style:disc!important;padding-inline-start:1.5em;}
.hoho-page.hoho-page .hoho-prose ol{list-style:decimal!important;padding-inline-start:1.5em;}
.hoho-page.hoho-page .hoho-prose img{width:100%;height:auto;max-height:22.1875rem;border-radius:var(--r-card);object-fit:cover;}
.hoho-page.hoho-page .hoho-prose figure{margin:0;}
.hoho-page.hoho-page .hoho-prose blockquote{margin:0;padding:var(--sp-3) var(--sp-4);border-radius:var(--r-card);background:var(--c-teal-05);}
@@ -63,3 +61,24 @@ body.hoho-fullwidth{overflow-x:hidden;}
/* A page's own Featured Image banner is shown as-is: no brand-teal tint. */
.hoho-page.hoho-page .hero--has-thumb .hero__media::after{display:none;}
/* Blog post header: real titles are long — use the full width (the design's
28rem cap wrapped them to four lines) with the meta underneath, and a
normal gap before the article instead of the design's ~100px. */
.hoho-page.hoho-page .post__head{flex-direction:column;align-items:flex-start;gap:var(--sp-2);margin-block-end:0;}
.hoho-page.hoho-page .post__title{max-width:none;}
.hoho-page.hoho-page .post__head + .post__body{margin-block-start:calc(var(--sp-5) - clamp(3rem, 2rem + 3vw, 6.25rem));}
/* Article headings by level (imported posts use h2–h6). */
.hoho-page.hoho-page .hoho-prose h2{margin:var(--sp-4) 0 0;font-size:clamp(1.25rem,1.1rem + .6vw,1.625rem);font-weight:700;line-height:1.25;}
.hoho-page.hoho-page .hoho-prose h3{margin:var(--sp-3) 0 0;font-size:1.25rem;font-weight:700;line-height:1.3;}
.hoho-page.hoho-page .hoho-prose :is(h4,h5,h6){margin:var(--sp-3) 0 0;font-size:1.0625rem;font-weight:700;line-height:1.35;}
/* Photos keep their own shape (portrait ones were cropped to a strip). */
.hoho-page.hoho-page .hoho-prose img{display:block;width:auto;max-width:100%;height:auto;max-height:36rem;margin-block:var(--sp-2);border-radius:var(--r-card);object-fit:contain;}
/* Unsized inline icons from imported content stay icon-sized. */
.hoho-page.hoho-page .hoho-prose svg{width:1em;height:1em;vertical-align:-.125em;}
/* Embedded maps/videos: full width, sensible height. */
.hoho-page.hoho-page .hoho-prose iframe{display:block;width:100%;height:auto;aspect-ratio:16/9;border:0;border-radius:var(--r-card);}

View File

@@ -168,7 +168,9 @@
});
obs.unobserve(entry.target);
});
}, { threshold: 0.15, rootMargin: '0px 0px -8% 0px' });
// threshold 0, not a ratio: a section taller than the screen (a long
// article) can never be 15% visible and would stay hidden forever.
}, { threshold: 0, rootMargin: '0px 0px -8% 0px' });
sections.forEach(function (section) { revealObserver.observe(section); });
}

View File

@@ -23,10 +23,10 @@ add_action( 'wp_enqueue_scripts', function () {
if ( wp_style_is( 'astra-theme-css', 'registered' ) ) {
$deps[] = 'astra-theme-css';
}
wp_enqueue_style( 'hoho-chrome', get_stylesheet_directory_uri() . '/assets/chrome.css', $deps, '1.0.14' );
wp_enqueue_style( 'hoho-chrome', get_stylesheet_directory_uri() . '/assets/chrome.css', $deps, '1.0.15' );
// Header interactions: burger, submenu, sticky, back-to-top, search toggle.
wp_enqueue_script( 'hoho-chrome', get_stylesheet_directory_uri() . '/assets/chrome.js', array(), '1.0.14', true );
wp_enqueue_script( 'hoho-chrome', get_stylesheet_directory_uri() . '/assets/chrome.js', array(), '1.0.15', true );
wp_add_inline_style(
'hoho-chrome',

View File

@@ -194,6 +194,21 @@ function hoho_blog_query( array $state ) {
);
}
/**
* Imported posts start with a stray "Home" breadcrumb line (left over from the
* old page builder). Drop it from the article and from card excerpts.
*/
function hoho_strip_leading_home( $text ) {
return preg_replace( '#^\s*(?:<p>\s*Home\s*</p>|Home\b\s*)#i', '', (string) $text );
}
add_filter(
'the_content',
function ( $content ) {
return ( is_singular( 'post' ) && in_the_loop() ) ? hoho_strip_leading_home( $content ) : $content;
},
20
);
/**
* Card date chip, as in the design: relative for the last week, then a date.
*/
@@ -240,7 +255,7 @@ function hoho_article_card( $post, $wrap = 'li' ) {
</a>
</div>
</div>
<p class="acard__excerpt"><?php echo esc_html( wp_trim_words( get_the_excerpt( $post ), 24, '&hellip;' ) ); ?></p>
<p class="acard__excerpt"><?php echo esc_html( wp_trim_words( hoho_strip_leading_home( get_the_excerpt( $post ) ), 24, '&hellip;' ) ); ?></p>
<?php
$inner = ob_get_clean();
if ( 'related' === $wrap ) {

View File

@@ -5,7 +5,7 @@ Description: Astra child theme that replaces the Astra header and footer with th
Author: Amir Bagheri
Author URI: https://ravisite.com
Template: astra
Version: 1.0.14
Version: 1.0.15
Text Domain: hoponhopoff
*/