Many Genesis themes support featured images, but what if some of your Posts and Pages don’t have featured images assigned?
Because Genesis is smart, if a Post or Page doesn’t have a featured image assigned, Genesis will display the first image you uploaded to that Post or Page in place of the featured image (if you didn’t upload any, it’ll display nothing).
However, it also gives you the option of setting a ‘default’ featured image as a fallback for any Post or Page that doesn’t have a featured image assigned.
genesis_get_image_default_args also provides you with the arguments passed to the function
genesis_get_image. This can be useful if you only want to use a fallback image under certain circumstances.
As an example, the below code will only set a fallback image in archives. Just replace the number 200 with the attachment ID of the image you want to use as your fallback.
You can also use WordPress native functions such as
in_category (amongst others) in order to only use a fallback image under certain circumstances.
As an example, the below code lets you use a different fallback image for different categories. Just replace Example Category 1 and Example Category 2 with the names of your categories and the numbers 200 and 400 with the attachment IDs of the images you want to use as your fallbacks.
genesis_get_image_default_args is located in lib/functions/image.php.