Title: Added conditional for missing image
Last modified: August 22, 2016

---

# Added conditional for missing image

 *  [Jenny Beaumont](https://wordpress.org/support/users/jennybeaumont/)
 * (@jennybeaumont)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/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
 * [https://wordpress.org/plugins/recent-facebook-posts/](https://wordpress.org/plugins/recent-facebook-posts/)

The topic ‘Added conditional for missing image’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/recent-facebook-posts_eae9f9.svg)
 * [Recent FB Posts](https://wordpress.org/plugins/recent-facebook-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/recent-facebook-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/recent-facebook-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/recent-facebook-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/recent-facebook-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/recent-facebook-posts/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Jenny Beaumont](https://wordpress.org/support/users/jennybeaumont/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/added-conditional-for-missing-image/)
 * Status: not resolved