Title: Default Thumb Problem
Last modified: August 20, 2016

---

# Default Thumb Problem

 *  [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/)
 * Im trying to use a default thumb if no post image exists but something is wrong
   and I keep getting a blank default. Help please.
 *     ```
       <?php $thumb = catch_that_image(); ?>
             <?php if ( $thumb ) { ?>
                  <img src="<?php echo $thumb; ?>" width="50" height="50" />
              <?php } else { ?>
                   <img src="http://mysite.com/wp-content/themes/fod/images/image.png" width="50" height="50" />
              <?php } ?>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Jacob Chappell](https://wordpress.org/support/users/master-jake/)
 * (@master-jake)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/#post-2499452)
 * Do you have a link to a page where this is occurring?
    Your code looks fine as
   long as `catch_that_image()` actually is returning a URL. I’ve never seen that
   function before by the way. Why aren’t you using `get_the_post_thumbnail()`?
 *  Thread Starter [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/#post-2499453)
 * The site is behind an under construction so I can’t. The function grabs the first
   image of the post and uses it for the thumb and that works fine. My problem is
   getting the default thumb I provided to show if the $thumb doesn’t exist. The
   link for it is correct but when I view the page source it shows a link for to“
   images/default.jpg”. Im super confused.
 *  [Jacob Chappell](https://wordpress.org/support/users/master-jake/)
 * (@master-jake)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/#post-2499457)
 * Just as a debug routine, try giving the image in your else block a width and 
   height of 75 and then reloading the page. This way you’ll be able to fully tell
   the difference between whether or not the if statement is succeeding. In other
   words, change your code to this:
 *     ```
       <?php $thumb = catch_that_image(); ?>
             <?php if ( $thumb ) { ?>
                  <img src="<?php echo $thumb; ?>" width="50" height="50" />
              <?php } else { ?>
                   <img src="http://mysite.com/wp-content/themes/fod/images/image.png" width="75" height="75" />
              <?php } ?>
       ```
   
 * Reload the page and look at the source. Is the image with width/height of 75 
   the one showing or is it still the 50×50?
 * If it’s the 50×50, then catch_that_image is actually returning the `images/default.
   jpg` and so your else statement is never being ran.
 *  Thread Starter [enderpal444](https://wordpress.org/support/users/enderpal444/)
 * (@enderpal444)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/#post-2499460)
 * lol yeap thats exactly what it was. Thanks for being way smarter than me Jacob!
 *  [Jacob Chappell](https://wordpress.org/support/users/master-jake/)
 * (@master-jake)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/#post-2499462)
 * Hehe, just glad I could help 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Default Thumb Problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Jacob Chappell](https://wordpress.org/support/users/master-jake/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/default-thumb-problem/#post-2499462)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
