From 4ae81a3c2a7e61ada433cfceb84055b61d15ae06 Mon Sep 17 00:00:00 2001 From: jdhalbert Date: Mon, 30 Jun 2025 09:14:00 -0700 Subject: [PATCH] add `alt` attribute to jumbotron shortcode - ensure an alt tag is always present on the jumbotron image - include in shortcode as `alt="alt text goes here"` - defaults to empty (decorative) if not provided --- inc/shortcodes/class.jumbotron-shortcode.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/inc/shortcodes/class.jumbotron-shortcode.php b/inc/shortcodes/class.jumbotron-shortcode.php index 8f19402..66a3840 100644 --- a/inc/shortcodes/class.jumbotron-shortcode.php +++ b/inc/shortcodes/class.jumbotron-shortcode.php @@ -42,6 +42,7 @@ public function jumbotron_handler( $atts, $content = null ) { 'button' => '', // required. button text. 'link' => '', // required. button link. 'id' => '', // optional ID. + 'alt' => '', // optional alt tag for the image ), $atts ); @@ -158,6 +159,13 @@ public function jumbotron_handler( $atts, $content = null ) { $image = ''; } + // if the image alt tag is set, get it. + if ( ! empty( $jumbotron_atts['alt'] ) ) { + $alt = $jumbotron_atts['alt']; + } else { + $alt = ''; + } + // get the button text. use default prompting if not provided. if ( $jumbotron_atts['button'] ) { $button_text = $jumbotron_atts['button']; @@ -179,7 +187,7 @@ public function jumbotron_handler( $atts, $content = null ) { // build the shortcode output. ob_start(); ?> -
class="jumbotron jumbotron-fluid " style="background-image: url();" > +
class="jumbotron jumbotron-fluid " style="background-image: url();" ><?php echo $alt ?>