Support » Plugins » Adding Timthumb to a dynamic image rotator

  • Hi. I’m really, really close on some code that I spent all of yesterday trying to figure out. I have some different code snippets that I’ve brought together and, with some luck, it’s actually 90% there!

    Unfortunately, I want it to work with WP’s custom front page setup, where the path to the actual blog becomes “http://localhost/wordpress/blog”… and therein lies my problem. I cannot seem to find a way to input the path to the file in my custom field and get it to work with the timthumb.php plugin. It works without it, using the relative path “../wp-content” and so on, but with timthumb, I can’t do it that way.

    Here’s the code. Any thoughts?

    		$featured_posts = get_posts('numberposts=3&category=10');
    		foreach( $featured_posts as $post ) {
    			$custom_image = get_post_custom_values('featured_image', $post->ID);
    			$image = $custom_image[0] ? $custom_image[0] : get_bloginfo("template_directory")."/images/no-featured-image.jpg";
    			printf('<li><a href="%s" title="%s"><img src="'. get_bloginfo("template_directory") .'/js/timthumb.php?%s" alt="%s" /></a></li>', get_permalink($post->ID), $post->post_title, $image, $post->post_title);
  • The topic ‘Adding Timthumb to a dynamic image rotator’ is closed to new replies.