perf/fix: externalize images to WP media; normalize Astra leaks; full-width
Plugin (1.8.2): - remove all bundled raster images (~9.3MB) from assets/img; hero + single hero figure now come from the WP Media Library (Settings), shortcode args ([viator_hero image_id]), or the vc_testimonials filter — rendered responsive - vc_hero_image_source() prefers an attachment ID (srcset); listing/hero use it - settings: store hero_image_id + single_hero_figure_id (media pickers) - enqueue at priority 20 + depend on astra-theme-css so our CSS wins ties - stronger Astra overrides (!important): kill page-builder article top padding (gap above hero), force full-bleed containers, guard horizontal scroll - normalize theme leaks inside .vc-app: no link underline, no list bullets (with prose exceptions for the tour Overview); gradient hero fallback Theme: normalize .hoho link/list leaks; rebuild installable ZIP. Also: move optimized originals to /removed-images/; ship viator-collector.zip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4hNL1PSHxXbu94SCenpKj
This commit is contained in:
@@ -138,6 +138,34 @@ function vc_hero_image_url() {
|
||||
return apply_filters( 'vc_hero_image_url', $url );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hero image *source* for the current view: an attachment ID when available
|
||||
* (so it can be rendered responsively), otherwise a URL. Resolution order:
|
||||
* 1. On a term archive, that term's own image.
|
||||
* 2. The "Hero image" chosen in Settings (attachment ID preferred).
|
||||
* 3. Nothing.
|
||||
*
|
||||
* @return int|string Attachment ID, image URL, or '' .
|
||||
*/
|
||||
function vc_hero_image_source() {
|
||||
if ( is_tax( array( 'viator_destination', 'viator_tag', 'viator_category' ) ) ) {
|
||||
$term = get_queried_object();
|
||||
if ( $term && ! is_wp_error( $term ) ) {
|
||||
$url = vc_term_image_url( $term->term_id, $term->taxonomy );
|
||||
if ( $url ) {
|
||||
return apply_filters( 'vc_hero_image_source', $url );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$id = (int) vc_get_option( 'hero_image_id', 0 );
|
||||
if ( $id ) {
|
||||
return apply_filters( 'vc_hero_image_source', $id );
|
||||
}
|
||||
|
||||
return apply_filters( 'vc_hero_image_source', (string) vc_get_option( 'hero_image', '' ) );
|
||||
}
|
||||
|
||||
function vc_term_image_url( $term_id, $taxonomy = '' ) {
|
||||
$term_id = absint( $term_id );
|
||||
if ( ! $term_id ) {
|
||||
|
||||
Reference in New Issue
Block a user