Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Timthumb in Contextual Related Posts & Top 10
<?php
/**
* Filter function to resize post thumbnail. Filters: crp_thumb_url.
*
* @since 1.8.4
*
* @param string $postimage
* @param string|int $thumb_width
* @param string|int $thumb_height
* @return object Post object
*/
function crp_scale_thumbs( $postimage, $thumb_width, $thumb_height, $post ) {
$timthumb = 'http://example.com/wp-content/timthumb';
return $timthumb . '/timthumb.php?src=' . urlencode( $postimage ) . '&amp;w=' . $thumb_width . '&amp;h=' . $thumb_height . '&amp;zc=1&amp;q=75';
}
add_filter( 'crp_thumb_url', 'crp_scale_thumbs', 10, 4 ); // Hook it to Contextual Related Posts
add_filter( 'tptn_thumb_url', 'crp_scale_thumbs', 10, 4 ); // Hook it to Top 10
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.