Undefined offset notice on blog page
-
I’m relatively new to working with PHP, so I hope someone can explain in simple terms how to resolve an undefined offset notice appearing above each excerpt on the blog page. The notice says
Notice: Undefined offset: 3 in /mnt/stor09-wc1-ord1/782565/855761/www.hirschmedia.biz/web/content/wp-content/themes/customizr/parts/class-content-post_list.php on line 173
It also points to an error on line 208.
Here’s the PHP code for line 173 and surrounding lines:
//check if tc-thumb size exists for attachment and return large if not $image = wp_get_attachment_image_src( $tc_thumb_id, $tc_thumb_size); if (null == $image[3]) { $tc_thumb_size = 'medium'; } $tc_thumb = get_the_post_thumbnail( get_the_ID(),$tc_thumb_size); //get height and width $tc_thumb_height = $image[2]; $tc_thumb_width = $image[1]; }
Here’s the code for line 208 and surrounding lines:
if ( isset($attachments) ) {
foreach ( $attachments as $attachment) {
//check if tc-thumb size exists for attachment and return large if not
$image = wp_get_attachment_image_src( $attachment->ID, $tc_thumb_size);
if (false == $image[3]) {
$tc_thumb_size = ‘medium’;
}
$tc_thumb = wp_get_attachment_image( $attachment->ID, $tc_thumb_size);
//get height and width
$tc_thumb_height = $image[2];
$tc_thumb_width = $image[1];
}I was wondering if this had something to do with deactivating the Regenerate Images plugin, but the Regenerate Images plugin developer recommends using Photon in Jetpack, and I’m doing that. I also tried reactivating Regenerate Images and that didn’t resolve the problem.
- The topic ‘Undefined offset notice on blog page’ is closed to new replies.