Set Genesis Default Featured Image

This PHP code enables you to display a default image as your post thumbnail featured image.

The default image will be displayed on all blog listings pages, including archives, author, blog, category, search, and tag pages.

You simply upload an image to your child themes images directory which matches the same file name and extension as whats in the code below which is default.png.

Please copy the code using the view raw link in the Gist and paste it at the end of your child themes functions.php file.

Genesis Filter Info

genesis_pre_get_image
Default value: false, $args, $post
Allows child theme to short-circuit the genesis_get_image function

WordPress Function Info

get_the_post_thumbnail
Parameters: $post-id, $size, $attr
Returns an empty string when the featured image is not set in the Edit post or page screen otherwise displays the image when one is set.

A Better Solution

This solution works better and enables you to maintain the same output as the Genesis settings:

Related Tutorials

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.