feat: page banners use the page's Featured Image when set

- Theme design pages (About, Contact, FAQ, blog list) use the page's Featured
  Image (Posts page for the blog) and fall back to the design photo; no teal
  tint over a custom image
- Plugin hero (homepage [viator_hero], [viator_listing] pages) prefers the
  hosting page's Featured Image over the Settings hero image
- Theme 1.0.12, plugin 1.9.4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-29 20:38:42 +03:30
parent fd6dba3203
commit 2f1ecd99b4
12 changed files with 35 additions and 14 deletions

View File

@@ -60,3 +60,6 @@ body.hoho-fullwidth{overflow-x:hidden;}
/* Form fields stay flat as in the design (Astra adds a shadow/border). */
.hoho-page.hoho-page .rinput{box-shadow:none!important;border:0!important;}
/* 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;}

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.11' );
wp_enqueue_style( 'hoho-chrome', get_stylesheet_directory_uri() . '/assets/chrome.css', $deps, '1.0.12' );
// 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.11', true );
wp_enqueue_script( 'hoho-chrome', get_stylesheet_directory_uri() . '/assets/chrome.js', array(), '1.0.12', true );
wp_add_inline_style(
'hoho-chrome',

View File

@@ -54,6 +54,16 @@ function hoho_asset( $path ) {
return get_stylesheet_directory_uri() . '/assets/' . ltrim( $path, '/' );
}
/**
* Banner image for a design page: the page's Featured Image when one is set
* (for the blog list, the Posts page's), otherwise the design's own photo.
*/
function hoho_banner_url( $fallback ) {
$page_id = ( is_home() && get_option( 'page_for_posts' ) ) ? (int) get_option( 'page_for_posts' ) : get_queried_object_id();
$url = $page_id ? get_the_post_thumbnail_url( $page_id, 'full' ) : '';
return $url ? $url : hoho_asset( 'img/' . $fallback . '.webp' );
}
/**
* Social profile links (footer + contact page). Override with the
* `hoho_socials` filter.

View File

@@ -4,7 +4,7 @@ Theme URI: https://git.kaamyab.dev/vargha/TourWebsite
Description: Astra child theme that replaces the Astra header and footer with the "Hop On Hop Off" design. Pairs with the Viator Collector plugin.
Author: Amir Bagheri
Template: astra
Version: 1.0.11
Version: 1.0.12
Text Domain: hoponhopoff
*/

View File

@@ -9,7 +9,7 @@ get_header();
<main id="main" class="hoho-page">
<section class="hero hero--page hero--about">
<div class="hero__media">
<img class="hero__img" src="<?php echo esc_url( hoho_asset( 'img/about-hero.webp' ) ); ?>" alt="" fetchpriority="high" />
<img class="hero__img" src="<?php echo esc_url( hoho_banner_url( 'about-hero' ) ); ?>" alt="" fetchpriority="high" />
</div>
<div class="container hero__content">

View File

@@ -40,7 +40,7 @@ for ( $n = 1; $n <= $hoho_max; $n++ ) {
<main id="main" class="hoho-page">
<section class="hero hero--archive hero--blog">
<div class="hero__media">
<img class="hero__img" src="<?php echo esc_url( hoho_asset( 'img/blogs-hero.webp' ) ); ?>" alt="" fetchpriority="high" />
<img class="hero__img" src="<?php echo esc_url( hoho_banner_url( 'blogs-hero' ) ); ?>" alt="" fetchpriority="high" />
<div class="hero__scrim" aria-hidden="true"></div>
</div>

View File

@@ -7,9 +7,9 @@ defined( 'ABSPATH' ) || exit;
get_header();
?>
<main id="main" class="hoho-page">
<section class="hero hero--page hero--contact">
<section class="hero hero--page hero--contact<?php echo has_post_thumbnail( get_queried_object_id() ) ? ' hero--has-thumb' : ''; ?>">
<div class="hero__media">
<img class="hero__img" src="<?php echo esc_url( hoho_asset( 'img/contact-hero.webp' ) ); ?>" alt="" fetchpriority="high" />
<img class="hero__img" src="<?php echo esc_url( hoho_banner_url( 'contact-hero' ) ); ?>" alt="" fetchpriority="high" />
</div>
<div class="container hero__content">

View File

@@ -7,9 +7,9 @@ defined( 'ABSPATH' ) || exit;
get_header();
?>
<main id="main" class="hoho-page">
<section class="hero hero--page hero--faq">
<section class="hero hero--page hero--faq<?php echo has_post_thumbnail( get_queried_object_id() ) ? ' hero--has-thumb' : ''; ?>">
<div class="hero__media">
<img class="hero__img" src="<?php echo esc_url( hoho_asset( 'img/faq-hero.webp' ) ); ?>" alt="" fetchpriority="high" />
<img class="hero__img" src="<?php echo esc_url( hoho_banner_url( 'faq-hero' ) ); ?>" alt="" fetchpriority="high" />
</div>
<div class="container hero__content">