Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active Dec 21, 2015
Embed
What would you like to do?
<?php
/**
* Only display Featured Image on archive
*
* By default, Genesis will use the first attached image if no featured
* image is provided. This limits the archive to only show featured images.
*
* @param string $output
* @param array $args
* @param object $post
* @return string $output
*/
function be_archive_featured_image_only( $output, $args, $post ) {
if( 'archive' == $args['context'] && !has_post_thumbnail( $post->ID ) )
$output = '';
return $output;
}
add_filter( 'genesis_pre_get_image', 'be_archive_featured_image_only', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment