Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Created June 16, 2014 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfmeier/f867d725f717b66ee671 to your computer and use it in GitHub Desktop.
Save rfmeier/f867d725f717b66ee671 to your computer and use it in GitHub Desktop.
Override image size that may not exist within genesis_get_image
<?php
/**
* functions.php
*
* In reply to Genesis Support forums.
* http://www.studiopress.com/forums/topic/maximum-width-and-height-of-images-in-winning-agent-pro-theme/
*/
add_filter( 'genesis_pre_get_image', 'custom_genesis_pre_get_image', 10, 3 );
/**
* Callback for Genesis 'genesis_pre_get_image' filter.
*
* Override the image size if specified as 'properties'.
*
* @param bool $check The return value. Default false.
* @param array $args The arguments for genesis_get_image()
* @param object $post The current post object.
* @return mixed The output. If the return value is false, this will be ignored.
*/
function custom_genesis_pre_get_image( $check, $args, $post ){
if( isset( $args['size'] ) && 'properties' !== $args['size'] )
return $check;
return genesis_get_image( array( 'size' => 'medium' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment