Skip to content

Instantly share code, notes, and snippets.

@ajaydsouza
Last active August 29, 2015 14:16
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 ajaydsouza/ea2f5b01e5bed4b3b917 to your computer and use it in GitHub Desktop.
Save ajaydsouza/ea2f5b01e5bed4b3b917 to your computer and use it in GitHub Desktop.
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