Images with get the Image plugin for Yarpp


/ Published in: PHP
Save to your folder(s)

You can see the results under a single post, where photos are shown, without any text. The photo is taken from the uploaded photo from the post. All you need is the get the image plugin from www.justintadlock.com


Copy this code and paste it in your HTML
  1. <?php /*
  2. Example template
  3. Author: mitcho (Michael Yoshitaka Erlewine) & Kokkekniven (Kristian Petersen)
  4. */
  5. ?><h3>Related posts</h3>
  6. <?php if ($related_query->have_posts()):?>
  7. <div>
  8. <?php while ($related_query->have_posts()) : $related_query->the_post(); ?>
  9. <a href="<?php the_permalink() ?>" rel="bookmark" class="relatedimage" title="<?php the_title() ?>"><span><?php get_the_image( array( 'custom_key' => array( 'Thumbnail' ), 'default_size' => 'thumbnail' ) ); ?></span>
  10. </a><!-- (<?php the_score(); ?>)-->
  11. <?php endwhile; ?>
  12. </div>
  13. <?php else: ?>
  14. <p>No related posts.</p>
  15. <?php endif; ?>
  16.  
  17. The style:
  18. Im using a textwidget to display the code, instead of using the widget coming with the plugin:
  19. #text-23{padding-left:15px;padding-right:15px;border:none;width:640px;display:block}
  20. #text-23 .thumbnail{width:93px;height:93px}
  21. #text-23 .H3{color:#000;font-size:20px;padding-top:10px}

URL: http://www.kokkekniven.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.