• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

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:

Register for full access

Related Tutorials

  • Add Fallback Featured Image For Jetpack Users
  • Set Fallback Featured Image & Default for Different Authors in Genesis
  • Set Fallback Featured Image For Each Category in Genesis

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags