Fixing cowboy coding

Signed-off-by: James Hunt <10615884+thetwopct@users.noreply.github.com>
This commit is contained in:
James Hunt 2024-11-29 13:35:50 +07:00
parent e35cc56abb
commit 85f88ff7b7
No known key found for this signature in database
GPG Key ID: 7F798A5F202EFC27
1 changed files with 5 additions and 5 deletions

View File

@ -3,8 +3,8 @@
* Banner ad Shortcode
*
* Usage example:
* [banner-ad desktop_image_id=120425 mobile_image_id=120426
* external_url="https://training.linuxfoundation.org/cyber-monday-cncf-2024/"
* [banner-ad desktop_image_id=120425 mobile_image_id=120426
* external_url="https://training.linuxfoundation.org/cyber-monday-cncf-2024/"
* alt_txt="CNCF Cyber Monday - Save up to 60%"]
*
* @package WordPress
@ -36,16 +36,16 @@ function add_banner_ad_shortcode( $atts ) {
$alt_txt = $atts['alt_txt'];
ob_start();
?>
?>
<div class="has-animation-scale-2" role="banner">
<a href="<?php echo esc_url( $external_url ); ?>" title="<?php echo esc_attr( $alt_txt ) ?>">
<a href="<?php echo esc_url( $external_url ); ?>" title="<?php echo esc_attr( $alt_txt ); ?>">
<picture>
<source media="(max-width: 499px)"
srcset="<?php echo esc_url( wp_get_attachment_image_url( $mobile_image_id, 'full', false ) ); ?>">
<source media="(min-width: 500px)"
srcset="<?php echo esc_url( wp_get_attachment_image_url( $desktop_image_id, 'full', false ) ); ?>">
<img src="<?php echo esc_url( wp_get_attachment_image_url( $desktop_image_id, 'full', false ) ); ?>"
alt="<?php echo esc_attr( $alt_txt ) ?>">
alt="<?php echo esc_attr( $alt_txt ); ?>">
</picture>
</a>
</div>