From 14ceb3f96a3b049457c38d5523ad5ef7958c2cb4 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 21 Oct 2026 23:05:05 -0700 Subject: [PATCH 01/18] Add a typed helper for the Ipsum version in patterns. Thirteen Ipsum patterns append the theme version to image URLs as a cache busting query string, read with `WP_Theme::get( 'Version' )`. That returns `string|false`, which `esc_attr()` does not accept, so each of the 60 call sites was a PHPStan level 7 error. `ipsum_get_version()` narrows the header to a string, falling back to an empty string when it cannot be read, and the patterns now call it. As before, the version comes from the parent theme. Co-Authored-By: Claude Opus 5.5 --- functions.php | 17 +++++++++++++++++ patterns/about-row.php | 2 +- patterns/cta-membership.php | 4 ++-- patterns/format-audio.php | 2 +- patterns/gallery-grid-full.php | 18 +++++++++--------- patterns/gallery-grid-wide.php | 18 +++++++++--------- patterns/gallery-grid.php | 22 +++++++++++----------- patterns/gallery-offset-full.php | 18 +++++++++--------- patterns/gallery-offset.php | 18 +++++++++--------- patterns/kind-words.php | 4 ++-- patterns/overlay-profile.php | 2 +- patterns/page-bio.php | 2 +- patterns/page-soon.php | 4 ++-- patterns/text-alternating.php | 6 +++--- 14 files changed, 77 insertions(+), 60 deletions(-) diff --git a/functions.php b/functions.php index 3732aed..6e00243 100644 --- a/functions.php +++ b/functions.php @@ -62,6 +62,23 @@ function ipsum_enqueue_styles() { endif; add_action( 'wp_enqueue_scripts', 'ipsum_enqueue_styles' ); +if ( ! function_exists( 'ipsum_get_version' ) ) : + /** + * Gets the theme version, for the cache busting query string on pattern images. + * + * The version comes from the parent theme, so a child theme's version doesn't + * stand in for Ipsum's. + * + * @since Ipsum 1.0 + * + * @return string The theme version, or an empty string if it cannot be read. + */ + function ipsum_get_version(): string { + $version = wp_get_theme( get_template() )->get( 'Version' ); + return is_string( $version ) ? $version : ''; + } +endif; + if ( ! function_exists( 'ipsum_comments_cta_binding' ) ) : /** * Returns the comments call to action for the current post. diff --git a/patterns/about-row.php b/patterns/about-row.php index 542589d..bd47d4e 100644 --- a/patterns/about-row.php +++ b/patterns/about-row.php @@ -29,7 +29,7 @@
-
<?php esc_attr_e( 'Portrait of the author.', 'ipsum' ); ?>
+
<?php esc_attr_e( 'Portrait of the author.', 'ipsum' ); ?>
diff --git a/patterns/cta-membership.php b/patterns/cta-membership.php index 6e78eed..ea43f43 100644 --- a/patterns/cta-membership.php +++ b/patterns/cta-membership.php @@ -13,8 +13,8 @@ ?>
-
-
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
+
+
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
diff --git a/patterns/format-audio.php b/patterns/format-audio.php index 1e61018..9d34528 100644 --- a/patterns/format-audio.php +++ b/patterns/format-audio.php @@ -14,7 +14,7 @@
-
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
diff --git a/patterns/gallery-grid-full.php b/patterns/gallery-grid-full.php index f32a8a8..ead93f3 100644 --- a/patterns/gallery-grid-full.php +++ b/patterns/gallery-grid-full.php @@ -26,39 +26,39 @@ -
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred plastic chair seen from behind, in iridescent pastel tones.', 'Alt text for the back view of the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair seen from behind, in iridescent pastel tones.', 'Alt text for the back view of the monobloc chair image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'Metal cylinders standing on a gray surface.', 'Alt text for the studio close-up image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Metal cylinders standing on a gray surface.', 'Alt text for the studio close-up image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
diff --git a/patterns/gallery-grid-wide.php b/patterns/gallery-grid-wide.php index 4a14747..f392c73 100644 --- a/patterns/gallery-grid-wide.php +++ b/patterns/gallery-grid-wide.php @@ -26,39 +26,39 @@ -
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred plastic chair seen from behind, in iridescent pastel tones.', 'Alt text for the back view of the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair seen from behind, in iridescent pastel tones.', 'Alt text for the back view of the monobloc chair image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'Metal cylinders standing on a gray surface.', 'Alt text for the studio close-up image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Metal cylinders standing on a gray surface.', 'Alt text for the studio close-up image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
diff --git a/patterns/gallery-grid.php b/patterns/gallery-grid.php index 9922ce8..01a2a3a 100644 --- a/patterns/gallery-grid.php +++ b/patterns/gallery-grid.php @@ -26,47 +26,47 @@ -
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred plastic chair seen from behind, in iridescent pastel tones.', 'Alt text for the back view of the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair seen from behind, in iridescent pastel tones.', 'Alt text for the back view of the monobloc chair image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'Metal cylinders standing on a gray surface.', 'Alt text for the studio close-up image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Metal cylinders standing on a gray surface.', 'Alt text for the studio close-up image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A blurred figure walking past an orange facade.', 'Alt text for the facade image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred figure walking past an orange facade.', 'Alt text for the facade image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A black ribbon-like sculpture curving across a pale background.', 'Alt text for the sculpture image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A black ribbon-like sculpture curving across a pale background.', 'Alt text for the sculpture image', 'ipsum' ); ?>
diff --git a/patterns/gallery-offset-full.php b/patterns/gallery-offset-full.php index a9f97ad..6f96b3b 100644 --- a/patterns/gallery-offset-full.php +++ b/patterns/gallery-offset-full.php @@ -15,7 +15,7 @@
-
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
@@ -23,7 +23,7 @@ -
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
@@ -31,7 +31,7 @@ -
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
@@ -41,7 +41,7 @@ -
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
@@ -49,7 +49,7 @@ -
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
@@ -57,13 +57,13 @@ -
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
@@ -71,7 +71,7 @@ -
<?php echo esc_attr_x( 'A desk fan blurred mid-spin against a blue background.', 'Alt text for the desk fan image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A desk fan blurred mid-spin against a blue background.', 'Alt text for the desk fan image', 'ipsum' ); ?>
@@ -79,7 +79,7 @@ -
<?php echo esc_attr_x( 'A person in profile, in shadow against a blue sky.', 'Alt text for the editorial portrait image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A person in profile, in shadow against a blue sky.', 'Alt text for the editorial portrait image', 'ipsum' ); ?>
diff --git a/patterns/gallery-offset.php b/patterns/gallery-offset.php index 4f5022d..c61b95c 100644 --- a/patterns/gallery-offset.php +++ b/patterns/gallery-offset.php @@ -15,7 +15,7 @@
-
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A dark metal tabletop on a single thin leg against a hazy sky.', 'Alt text for the metal table image', 'ipsum' ); ?>
@@ -23,7 +23,7 @@ -
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A black staircase climbing a white wall.', 'Alt text for the staircase image', 'ipsum' ); ?>
@@ -31,7 +31,7 @@ -
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A glowing pendant lamp above a warm orange room.', 'Alt text for the pendant lamp image', 'ipsum' ); ?>
@@ -41,7 +41,7 @@ -
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A blurred plastic chair in blue and cream tones.', 'Alt text for the monobloc chair image', 'ipsum' ); ?>
@@ -49,7 +49,7 @@ -
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Rows of glossy black hollow cones catching the light.', 'Alt text for the polygons image', 'ipsum' ); ?>
@@ -57,13 +57,13 @@ -
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'The number 27 fading into blue and pink light.', 'Alt text for the lead letter image', 'ipsum' ); ?>
-
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A capital A pressed into brushed metal.', 'Alt text for the capital letter image', 'ipsum' ); ?>
@@ -71,7 +71,7 @@ -
<?php echo esc_attr_x( 'A desk fan blurred mid-spin against a blue background.', 'Alt text for the desk fan image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A desk fan blurred mid-spin against a blue background.', 'Alt text for the desk fan image', 'ipsum' ); ?>
@@ -79,7 +79,7 @@ -
<?php echo esc_attr_x( 'A person in profile, in shadow against a blue sky.', 'Alt text for the editorial portrait image', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'A person in profile, in shadow against a blue sky.', 'Alt text for the editorial portrait image', 'ipsum' ); ?>
diff --git a/patterns/kind-words.php b/patterns/kind-words.php index 21eeb50..88d1efd 100644 --- a/patterns/kind-words.php +++ b/patterns/kind-words.php @@ -14,7 +14,7 @@
-
<?php echo esc_attr_x( 'Black-and-white portrait of a woman with short curly hair in a dark blazer.', 'Alt text for a reader portrait', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Black-and-white portrait of a woman with short curly hair in a dark blazer.', 'Alt text for a reader portrait', 'ipsum' ); ?>
@@ -26,7 +26,7 @@
-
<?php echo esc_attr_x( 'Black-and-white portrait of a smiling woman with curly hair.', 'Alt text for a reader portrait', 'ipsum' ); ?>
+
<?php echo esc_attr_x( 'Black-and-white portrait of a smiling woman with curly hair.', 'Alt text for a reader portrait', 'ipsum' ); ?>
diff --git a/patterns/overlay-profile.php b/patterns/overlay-profile.php index 79048f9..d5304c0 100644 --- a/patterns/overlay-profile.php +++ b/patterns/overlay-profile.php @@ -19,7 +19,7 @@
-
<?php esc_attr_e( 'Portrait of the author.', 'ipsum' ); ?>
+
<?php esc_attr_e( 'Portrait of the author.', 'ipsum' ); ?>
diff --git a/patterns/page-bio.php b/patterns/page-bio.php index 17beb6a..235c1d4 100644 --- a/patterns/page-bio.php +++ b/patterns/page-bio.php @@ -18,7 +18,7 @@