Title: Recent Posts &#038; Image plugin or script (help needed!)
Last modified: August 18, 2016

---

# Recent Posts & Image plugin or script (help needed!)

 *  [neilcauldwell](https://wordpress.org/support/users/neilcauldwell/)
 * (@neilcauldwell)
 * [18 years, 9 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/)
 * Hi Everyone
 * I’ve been hacking away at this issue for a while now, and I just can’t get the
   solution.
 * I want a ‘Recent Posts’ script that works in combination with the guff Post Image
   plugin. I’ve tried using the code below, but each ‘recent post’ only seems to
   show its’ relevant image (as specified by the Post Image plugin) when the same
   post is shown within the Loop on the same page;
 *     ```
       <ul>
       				<li><h3>Recent Posts</h3></li>
       				<?php
       						               $postslist = get_posts('numberposts=3&offset=1&order=DESC&orderby=post_date');
       						               foreach ($postslist as $post) {
       						      ?>
       						            <ul><li class="recent_post" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink(); ?>"><img class="postimage" src="<?php post_image('shared/images/post/post_default.jpg', false, false); ?>" width="48" height="48" /></a></a><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3><p class="meta"><?php the_time('F'); ?> <?php the_time('jS Y'); ?> under <?php the_category(' &amp; ') ?> <?php edit_post_link(); ?>
       </li></ul>
       						            <?php }; ?>
       			</ul>
       ```
   
 * So, that means that unless a post is pulled up within the Loop on the same page,
   the same post, when shown in the ‘Recent Posts’ script, won’t show its’ own image–
   it will just show the default Post Image icon which I have specified.
 * Obviously there is some kind of attribute that is unique to each post and is 
   pulled-up when a post is called within the Loop. The ‘Recent Posts’ script (shown
   above) doesn’t seem to call this attribute (whatever that may be) – so I’m under
   the impression that this Recent Posts script isn’t a ‘ proper Loop’ as such.
 * I’ve also tried calling the Loop, as suggested by the moderator further down 
   in the this thread, [http://wordpress.org/support/topic/63004?replies=8](http://wordpress.org/support/topic/63004?replies=8),
   but I can’t get the loop to work within the provided imgposts script – it won’t
   display anything.
 * Is there a way of calling the Loop, so that it only shows the last 3 posts, with
   an offset of 1, and so that it formats the posts in a similar way to the script
   I’ve posted above (inc. the post image) ?
 * Any help is very much appreciated! I’m going crazy over this one!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [xinfo](https://wordpress.org/support/users/xinfo/)
 * (@xinfo)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/#post-618103)
 * even i face the same problem
 * well solution
 * IMPORTANT :old upload images won’t work which is uploaded before you activate
   the plugin .
    your new images will work fine .
 * if you want to follow the above [forum](http://wordpress.org/support/topic/63004?replies=8,)
   link code which you posted there is small change you have to do in the [code](http://wordpress.org/support/topic/63004?replies=8%2C#post-498035)
 * line 3
 * you have change
 * from
 * while($imgposts->haveposts()) :
 * to
 * while($imgposts->have_posts()) :
 *  Thread Starter [neilcauldwell](https://wordpress.org/support/users/neilcauldwell/)
 * (@neilcauldwell)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/#post-618106)
 * Thanks xinfo – I just tried that and, although it pulls out the posts as expected,
   it still has the same problem with the images not being posted in the imgposts*
   unless* the post is also pulled up in the Loop. I presume that this is because
   the Wp_Query function doesn’t pull up a certain attribute which the Loop does.
   It also has the unwanted function, whereby clicking on a ‘Continue Reading’ link
   from a post in the Loop will also extend ALL the posts pulled up in the imgposts
   script.
 * Here is the code that I was using;
 *     ```
       <?php
       					$imgposts = new WP_Query('showposts=3');
       					if($imgposts->have_posts()) : while($imgposts->have_posts()) : $imgposts->the_post(); ?>
   
       					<div class="post clearfix" id="post-<?php the_ID(); ?>">
       						<div class="posttitle">
       							<a href="<?php the_permalink(); ?>"><img class="postimage" src="<?php post_image('shared/images/post_default.jpg', false, false); ?>" width="48" height="48" /></a>
       				 			<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
       							<p class="meta">
       								<?php the_time('F'); ?> <?php the_time('jS Y'); ?> under <?php the_category(' &amp; ') ?> <?php edit_post_link(); ?></p>
       						</div>
       						<div class="postcontent">
       							<?php the_content(__('continue reading...')); ?>
       						</div>
       						<div class="postfeedback">
       							<?php wp_link_pages(); ?>
       							<?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)', 'commentlink', ''); ?>
       						</div>
       					</div>
   
       					<?php endwhile; endif; ?>
       ```
   
 *  Thread Starter [neilcauldwell](https://wordpress.org/support/users/neilcauldwell/)
 * (@neilcauldwell)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/#post-618140)
 * I’m still struggling with getting the ‘Recent Posts’ Loop to pull up the respective
   Post Image when each Recent Post isn’t being displayed in the first Loop. For
   example, let’s say I have one post in the Loop, Post 3, and I have three posts
   in the ‘Recent Posts’ Loop, Post 1, Post 2, and Post 3 again.
 * Post 3 will show its Post Image in both the Loop and in the Recent Posts Loop–
   but Post 1 and Post 2 won’t show their Post Images in the Recent Posts Loop, 
   because they aren’t being called in the first Loop. And, if I was to click on
   Post 1 to bring it up in the first Loop, Post 3 would no longer show its’ Post
   Image in the Recent Posts Loop, because it isn’t being called in the first Loop!
 * My site is DotNeil.com – but it’s a new site, so I only have one post with a 
   Post Image, so I don’t think you’ll be able to replicate the problem on this 
   site until I’ve made some more posts with images.
 *  [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * (@noelgreen)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/#post-618218)
 * Did you ever figure this out?
    If so… what did you do?
 *  [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * (@noelgreen)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/#post-618219)
 * Figured it out!
    Give up on the “post_image” plug-in for this and simply [do what’s talked about in this post!](http://wordpress.org/support/topic/140609?replies=7#post-779279)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Recent Posts & Image plugin or script (help needed!)’ is closed to new
replies.

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [recent](https://wordpress.org/support/topic-tag/recent/)

 * 5 replies
 * 3 participants
 * Last reply from: [noelgreen](https://wordpress.org/support/users/noelgreen/)
 * Last activity: [17 years, 9 months ago](https://wordpress.org/support/topic/recent-posts-038-image-plugin-or-script-help-needed/#post-618219)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
