fix: Astra style conflicts, full-width, responsive hero images, header search
Plugin (viator-collector 1.8.1): - is_vc_page() now matches any Viator shortcode, so shortcode Pages (home) get the full-width no-sidebar canvas - load vc-design.css after Astra + inline overrides: strip Astra page-builder article padding (removes extra gap above hero), full-bleed containers, enforce design font inside .vc-app - vc_hero_img_html(): render hero from the WP media library with responsive srcset when the image is an attachment; used in listing + [viator_hero] ([viator_hero image_id=".."]) Theme (astra child): - remove the user/profile header item - working header search (expands, submits to the tours archive ?vc_q=) - load chrome.css after Astra + enforce design font inside .hoho - rebuild installable ZIP Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4hNL1PSHxXbu94SCenpKj
This commit is contained in:
@@ -506,6 +506,45 @@ function vc_asset_url( $rel ) {
|
||||
return VC_PLUGIN_URL . 'assets/' . ltrim( (string) $rel, '/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hero <img> markup. When the source is a WordPress media item (an attachment
|
||||
* ID, or a URL that resolves to one), it is rendered with wp_get_attachment_image
|
||||
* so the browser gets responsive `srcset`/`sizes` and device-appropriate files.
|
||||
* Anything else (external URLs, bundled fallbacks) falls back to a plain <img>.
|
||||
*
|
||||
* @param int|string $src Attachment ID or image URL.
|
||||
* @param string $class CSS class.
|
||||
* @param bool $eager Prioritise loading (above-the-fold hero).
|
||||
*/
|
||||
function vc_hero_img_html( $src, $class = 'hero__img', $eager = true ) {
|
||||
$loading = $eager ? 'eager' : 'lazy';
|
||||
|
||||
$id = is_numeric( $src ) ? (int) $src : (int) attachment_url_to_postid( (string) $src );
|
||||
if ( $id ) {
|
||||
$img = wp_get_attachment_image(
|
||||
$id,
|
||||
'full',
|
||||
false,
|
||||
array(
|
||||
'class' => $class,
|
||||
'loading' => $loading,
|
||||
'alt' => '',
|
||||
'sizes' => '100vw',
|
||||
'fetchpriority' => $eager ? 'high' : 'auto',
|
||||
)
|
||||
);
|
||||
if ( $img ) {
|
||||
return $img;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $src ) {
|
||||
return '';
|
||||
}
|
||||
$fetch = $eager ? ' fetchpriority="high"' : '';
|
||||
return '<img class="' . esc_attr( $class ) . '" src="' . esc_url( $src ) . '" alt="" loading="' . esc_attr( $loading ) . '"' . $fetch . '>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the "Hop On Hop Off" SVG icon sprite once per request. The sprite
|
||||
* holds every <symbol id="i-…"> plus the #ringPathScroll circular text path
|
||||
|
||||
Reference in New Issue
Block a user