Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active December 10, 2015 23:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/4511884 to your computer and use it in GitHub Desktop.
Save billerickson/4511884 to your computer and use it in GitHub Desktop.
<?php
// Our large image size
add_image_size( 'be_large', 500, 500, true );
/**
* Genesis Grid - Use different image on CPT archive
*
* @author Bill Erickson
* @link http://wordpress.org/support/topic/filter-the-image-for-cpt-archive
*
* @param string $image_size
* @return string
*/
function be_cpt_image_size( $image_size ) {
// Only run on the 'image' post type archive
if( !is_post_type_archive( 'image' ) )
return $image_size;
if( in_array( 'feature', get_post_class() ) )
$image_size = 'be_large';
return $image_size;
}
add_filter( 'genesis_pre_get_option_image_size', 'be_cpt_image_size', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment