Skip to content

Instantly share code, notes, and snippets.

@paaljoachim
Created August 20, 2015 06:52
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 paaljoachim/df42fde2ed57b5589813 to your computer and use it in GitHub Desktop.
Save paaljoachim/df42fde2ed57b5589813 to your computer and use it in GitHub Desktop.
Define a post thumbnail with Genesis child themes.
//* Define a default post thumbnail
//* http://dreamwhisperdesigns.com/genesis-tutorials/genesis-default-thumbnails/
add_filter('genesis_get_image', 'default_image_fallback', 10, 2);
function default_image_fallback($output, $args) {
global $post;
if( $output || $args['size'] == 'full' )
return $output;
$thumbnail = CHILD_URL.'/images/WordPress-info150x150.jpg';
switch($args['format']) {
case 'html' :
return '<img src="'.$thumbnail.'" class="attachment-'. $args['size'] .'" alt="'. get_the_title($post->ID) .'" />';
break;
case 'url' :
return $thumbnail;
break;
default :
return $output;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment