Support » Multisite » [Resolved] How to use TimThumb.php in WordPress 3.0 MU

[Resolved] How to use TimThumb.php in WordPress 3.0 MU

  • Hey,

    So I am using WordPress 3.0 MU. I am creating theme that has different sections on the homepage for 5 different subdirectory blogs. I am using some code I got here (http://www.staenzwebsolutions.com/get-recent-posts-from-various-blogs-on-wordpress-mu-site/324) to select recent posts by blogid and also selecting by category id. I’ll post the code I’m using in a second but heres my problem.

    I want to display a thumbnail image as well and have it resized by timthumb.php. When I just display the image link using get_post_meta it works fine, but when i try to resize it using timthumb, no luck.

    Anyways, heres my code, any help would be great! thanks
    function get_recent_blogposts_featured_nfl($blog_id,$show){
    global $post;?>
    <?php $my_query = new WP_Query(‘showposts=’.$show.’&order=DSC&category_id=1467′);
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <img src=”<?php bloginfo(‘template_directory’); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, “thumb”, $single = true); ?>&h=150&w=350&zc=1″ /><h3>” rel=”bookmark”><?php the_title(); ?></h3>
    <div style=”clear:left;”></div>
    <?php endwhile; ?>
    <?php restore_current_blog();

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Andrea Rennick


    Customer Care at Copyblogger Media and Studiopress

    Ok, I’m not 100% sure how to use that code with my code. Here is what I have created, but its still not returning a picture. I think I’m using it wrong. I’m still trying to mess around with it but anymore help would be great. Thanks

    function get_recent_blogposts_featured_nfl($blog_id,$show,$cat_id){
    	global $post;?>
    	<?php $my_query = new WP_Query('showposts='.$show.'&order=DSC&category_id='.$cat_id);
    	while ($my_query->have_posts()) : $my_query->the_post();
    	    $do_not_duplicate = $post->ID;
    		function get_image_path ($post_id = null) {
    		if ($post_id == null) {
    			global $post;
    			$post_id = $post->ID;
    		$theImageSrc = get_post_meta($post_id, 'thumb', true);
    		global $blog_id;
    		if (isset($blog_id) && $blog_id > 0) {
    			$imageParts = explode('/files/', $theImageSrc);
    			if (isset($imageParts[1])) {
    				$theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    		return $theImageSrc;
    	} ?>
            <img src="<?php echo $theImageSrc; ?>"  /><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
            <div style="clear:left;"></div>
    	<?php endwhile; ?>
    	<?php restore_current_blog();

    Got it working



    Could you perhaps post how you got it working? I’m really frustrated with this issue and would like to resolve it quickly.



    Hey, have you tried to use thumbGen?. Is a plugin that makes exactly the same than timthumb but is so much easier to use and install. Is a plugin made by myself, but please, take a look at it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] How to use TimThumb.php in WordPress 3.0 MU’ is closed to new replies.