Last active
August 29, 2015 14:20
-
-
Save reasonstousegenesis/b9e6801f926e175f8f68 to your computer and use it in GitHub Desktop.
Set a fallback featured image based on args
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 | |
// Paste the code BELOW this line into your child theme functions. | |
/** | |
* Set a fallback featured image based on args | |
* | |
* @author Reasons to Use Genesis | |
* @link http://reasonstousegenesis.com/default-featured-image/ | |
*/ | |
add_filter( 'genesis_get_image_default_args', 'rtug_fallback_featured_image_args', 10, 2 ); | |
function rtug_fallback_featured_image_args( $defaults, $args ) { | |
if ( isset( $args[ 'context' ] ) && 'archive' === $args[ 'context' ] ) | |
$defaults[ 'fallback' ] = 200; // replace with your attachment ID | |
return $defaults; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment