-
-
Save rfmeier/f867d725f717b66ee671 to your computer and use it in GitHub Desktop.
Override image size that may not exist within genesis_get_image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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