Created
September 6, 2012 03:55
-
-
Save yao3060/3651021 to your computer and use it in GitHub Desktop.
Get Featured Image with timthumb
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 | |
$w = '350'; | |
$h = '200'; | |
if (has_post_thumbnail()) { | |
$large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); | |
echo '<img class="wp-post-image" src="' . get_bloginfo("template_url") . '/timthumb.php?src=' . $large_image_url[0] . '&w=' . $w . '&h=' . $h . '" alt="' . get_the_title() . '" title="#htmlcaption' . get_the_ID() . '" /></a>'; | |
} else { | |
echo '<img src="http://fakeimg.pl/350x200/?text=NoPictrue&font=lobster" alt="no pictrue" />'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment