Last active
August 29, 2015 14:05
-
-
Save graylaurenm/1fa7de6b15e862a94b1f to your computer and use it in GitHub Desktop.
Add default fallback image in Genesis
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 | |
/** | |
* Set default fallback image | |
* Modified from: https://gist.github.com/GaryJones/7070243 | |
* See: genesis\lib\functions\image.php | |
*/ | |
add_filter( 'genesis_get_image_default_args', 'prefix_stop_auto_featured_image' ); | |
function prefix_stop_auto_featured_image( $args ) { | |
if ( ! isset( $args['context'] ) /*|| 'archive' !== $args['context']*/ ) | |
return $args; | |
$id = '4740'; | |
$lgd_html = wp_get_attachment_image( $id, $args['size'], false, $args['attr'] ); | |
list( $lgd_url ) = wp_get_attachment_image_src( $id, $args['size'], false ); | |
$lgd_fallback = array( | |
'url' => $lgd_url, | |
'html' => $lgd_html, | |
); | |
$args['fallback'] = $lgd_fallback; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment