Skip to content

Commit 982dd27

Browse files
authored
Merge pull request #450 from TycheSoftwares/fix-449
Fix #449 Added check for PHP Notice: Trying to access array offset on…
2 parents ea20003 + 34761d3 commit 982dd27

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

includes/wcdn-template-functions.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,14 @@ function wcdn_company_logo() {
250250
$company = get_option( 'wcdn_custom_company_name' );
251251
if ( $attachment_id ) {
252252
$attachment_src = wp_get_attachment_image_src( $attachment_id, 'full', false );
253-
// resize the image to a 1/4 of the original size to have a printing point density of about 288ppi.
254-
?>
255-
<div class="logo">
256-
<img src="<?php echo esc_url( $attachment_src[0] ); ?>" class="desktop" width="<?php echo esc_attr( round( $attachment_src[1] / 4 ) ); ?>" height="<?php echo esc_attr( round( $attachment_src[2] / 4 ) ); ?>" alt="<?php echo esc_attr( $company ); ?>" />
257-
</div>
258-
<?php
253+
if ( $attachment_src ) {
254+
// resize the image to a 1/4 of the original size to have a printing point density of about 288ppi.
255+
?>
256+
<div class="logo">
257+
<img src="<?php echo esc_url( $attachment_src[0] ); ?>" class="desktop" width="<?php echo esc_attr( round( $attachment_src[1] / 4 ) ); ?>" height="<?php echo esc_attr( round( $attachment_src[2] / 4 ) ); ?>" alt="<?php echo esc_attr( $company ); ?>" />
258+
</div>
259+
<?php
260+
}
259261
}
260262
}
261263

0 commit comments

Comments
 (0)