Support » Plugins » Random posts with timthumb?

  • Hello!!

    My homepage is and I´m using the Arthemia theme which I´ve modified by a lot. I wanted to try how it would look if I tried to have a random posts section as seen here:

    The thing is that I want to use the timthumb resizer to make the same effect. While I can make it so that I get random posts the pain is that the same thumbnail is used for every single post.

    When that happends I follow the example

    <ul><li><h2>A random selection of my writing</h2>
     $rand_posts = get_posts('numberposts=5&amp;orderby=rand');
     foreach( $rand_posts as $post ) :
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>

    But I make a bit of a change.

    <h3>Random posts</h3>
     $rand_posts = get_posts('numberposts=7&amp;orderby=rand');
     foreach( $rand_posts as $post ) :
    <?php	$values = get_post_custom_values("Image");
    	if (isset($values[0])) { ?>
          <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    	<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
    $values = get_post_custom_values("Image"); echo $values[0]; ?>&amp;w=120&amp;h=120&amp;zc=1&amp;q=100"
    alt="<?php the_title(); ?>" class="left" width="285px" height="150px"  /></a>
          <?php } ?>
    <?php endwhile;?>

    This displays a list of random posts. But with the same image.

    Any easy way to fix this so that everything works out nicely? I´m at a loss of what to do next.

  • The topic ‘Random posts with timthumb?’ is closed to new replies.