Added conditional for missing image
-
Me again! Having a great time mucking about with this plugin ??
Was getting a missing image on posts when there was no image attached, so added this this conditional in includes/class-public.php (somewhere around line 140, though I’ve moved stuff around a bit):
if ( !empty( $p['image'] ) ) { ?> <a class="rfbp-image-link" target="<?php echo $link_target; ?>" href="<?php echo $p['url']; ?>" rel="external nofollow"> <?php $max_img_width = ( ! empty( $opts['img_width'] ) ) ? $opts['img_width'].'px' : '100%'; $max_img_height = ( !empty( $opts['img_height'] ) ) ? $opts['img_height'].'px' : 'none'; ?> <img class="rfbp-image" src="<?php echo esc_attr( $p['image'] . '?type=' . $opts['img_size'] ); ?>" style="<?php echo esc_attr( "max-width: {$max_img_width}; max-height: {$max_img_height}" ); ?>" alt="" /> </a> <?php } ?>
thought I’d share ??
cheers!
-jennyb
- The topic ‘Added conditional for missing image’ is closed to new replies.