Last active
August 29, 2015 14:16
-
-
Save ajaydsouza/ea2f5b01e5bed4b3b917 to your computer and use it in GitHub Desktop.
Timthumb in Contextual Related Posts & Top 10
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 | |
/** | |
* 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 ) . '&w=' . $thumb_width . '&h=' . $thumb_height . '&zc=1&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