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:
@@ -24,7 +24,9 @@ class VC_Display {
|
||||
);
|
||||
|
||||
public static function init() {
|
||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ) );
|
||||
// Priority 20 so Astra has already registered/enqueued its stylesheet;
|
||||
// our CSS then loads after it and wins equal-specificity ties.
|
||||
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_assets' ), 20 );
|
||||
add_action( 'template_redirect', array( __CLASS__, 'maybe_enrich_single' ) );
|
||||
add_action( 'pre_get_posts', array( __CLASS__, 'filter_archive_query' ) );
|
||||
add_filter( 'single_template', array( __CLASS__, 'single_template' ) );
|
||||
@@ -170,14 +172,36 @@ class VC_Display {
|
||||
'',
|
||||
array(
|
||||
// Full-bleed: strip Astra's page-builder article padding/width so
|
||||
// the hero and sections reach the viewport edges (fixes the extra
|
||||
// top gap above the hero and the non-full-width sections).
|
||||
'.vc-fullwidth .site-main>article,.vc-fullwidth .ast-page-builder-template .site-main>article{padding:0;margin:0;border:0;}',
|
||||
'.vc-fullwidth #primary{margin:0;padding:0;}',
|
||||
'.vc-fullwidth .site-content .ast-container{max-width:none;padding-inline:0;}',
|
||||
'.vc-fullwidth .ast-container{max-width:none;}',
|
||||
'.vc-fullwidth .entry-content{margin-block:0;}',
|
||||
'.vc-fullwidth .site-content{padding:0;}',
|
||||
// the hero and sections reach the viewport edges. !important beats
|
||||
// Astra's own high-specificity rules (e.g. the 2em article padding
|
||||
// that leaves a gap above the hero).
|
||||
'.vc-fullwidth .site-main>article,'
|
||||
. '.vc-fullwidth .ast-page-builder-template .site-main>article,'
|
||||
. '.vc-fullwidth.ast-page-builder-template .site-main>article'
|
||||
. '{padding:0!important;margin:0!important;border:0!important;max-width:none!important;}',
|
||||
'.vc-fullwidth #primary,.vc-fullwidth #content{margin:0!important;padding:0!important;}',
|
||||
'.vc-fullwidth .site-content .ast-container,.vc-fullwidth .ast-container'
|
||||
. '{max-width:none!important;padding-left:0!important;padding-right:0!important;}',
|
||||
'.vc-fullwidth .entry-content{margin-block:0!important;}',
|
||||
'.vc-fullwidth .site-content{padding:0!important;}',
|
||||
// Guard against a stray horizontal scrollbar from any full-bleed child.
|
||||
'body.vc-fullwidth{overflow-x:hidden;}',
|
||||
// A gradient stands in when no hero image is set, so the banner is
|
||||
// never blank.
|
||||
'.vc-app .hero__media,.vc-app .hero-tour{background:linear-gradient(120deg,#101317,#2cafc2);}',
|
||||
// Normalize: stop Astra from decorating our components. Its
|
||||
// .entry-content rules (underlined links, list bullets/indent)
|
||||
// out-specify our scoped base, so reset them here (!important beats
|
||||
// e.g. `.ast-single-post .entry-content a`). The .vc-app.vc-app
|
||||
// doubling lifts specificity without touching design class rules.
|
||||
'.vc-app a,.vc-app.vc-app a{text-decoration:none;box-shadow:none;}',
|
||||
'.vc-app :is(ul,ol),.vc-app.vc-app :is(ul,ol){list-style:none!important;margin:0!important;padding:0!important;}',
|
||||
'.vc-app li{margin:0!important;}',
|
||||
// …but keep the tour "Overview" prose (the_content) readable.
|
||||
'.vc-app .tour__text a{text-decoration:underline;}',
|
||||
'.vc-app .tour__text ul{list-style:disc!important;margin:1em 0!important;padding-inline-start:1.5em!important;}',
|
||||
'.vc-app .tour__text ol{list-style:decimal!important;margin:1em 0!important;padding-inline-start:1.5em!important;}',
|
||||
'.vc-app .tour__text li{margin:.25em 0!important;}',
|
||||
// Typography: force the design font over Astra inside our scopes.
|
||||
'.vc-app,.vc-app h1,.vc-app h2,.vc-app h3,.vc-app h4,.vc-app h5,.vc-app h6,'
|
||||
. '.vc-app p,.vc-app a,.vc-app span,.vc-app li,.vc-app button,.vc-app input,'
|
||||
|
||||
Reference in New Issue
Block a user