• Hi I am using a script that displays related post to the particular blog post:

    $tags = wp_get_post_tags($post->ID);
       if ($tags) {
       echo '';
       $first_tag = $tags[0]->term_id;
       $args=array(
      'tag__in' => array($first_tag),
      'post__not_in' => array($post->ID),
      'showposts'=>5,
      'caller_get_posts'=>1
      );
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
      <li>
        <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
      </li>
      <?php
      endwhile;
      }
      }

    But I want it to display a thumbnail image of the blog post as well. Every blog post I have a custom field with a image on. I want it to display this image resized to a thumbnail sized: 36px x 36px

    Does anyone know how do I do this? Much help is appreciated

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks for the code … I want to implement something like that too without a plugin.

    What do you need help with? Getting the images or doing the resizing?

    Try This

    <li>
        <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <a href="<?php the_permalink() ?>" rel="bookmark">
    <?php $image = get_post_meta($post->ID, 'thumbnail', true); /* Replace lead_image with the name of the custom field for the image you want to use */ ?>
    <img style=" margin:0px; border:0px;" width="36" height="36" alt="<?php the_title(); ?>" src="<?php echo $image ?>" /></a>
      </li>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Related Posts with Thumbnails’ is closed to new replies.