Created
August 20, 2015 06:52
-
-
Save paaljoachim/df42fde2ed57b5589813 to your computer and use it in GitHub Desktop.
Define a post thumbnail with Genesis child themes.
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
//* 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