Strange problem with displaying recent posts

Good point sir, is the following alright? Can't get rid of the isset($values) one as it checks to see whether or not there is an image for the post..

PHP:
<?php 
    $thepost = $post; 
    $categories = get_the_category(); 
    foreach ($categories as $category)  
    { 
        $currentpage = $post->ID; 
        $posts = get_posts('numberposts=5&orderby=rand&category='. $category->term_id . '&exclude=' . $currentpage); 
        foreach( $posts as $post ) 
        { 
            $values = get_post_meta($post->ID, "Image", true); 
            if (isset($values[0]))  
            { 
                ?><div class="morecatimg"> 
                    <img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $values; ?>&amp;w=105&amp;h=105&amp;zc=1&amp;q=85" alt="<?php the_title(); ?>" height="105" width="105" /> 
                    <div class="morecattext"> 
                    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> 
                    </div> 
                </div><?php 
            } 
        } 
    } 
    $post = $thepost;  
?>

Thanks again.
 
Back
Top Bottom