Title: random sidebar posts including image
Last modified: August 18, 2016

---

# random sidebar posts including image

 *  [zyco](https://wordpress.org/support/users/zyco/)
 * (@zyco)
 * [19 years, 5 months ago](https://wordpress.org/support/topic/random-sidebar-posts-including-image/)
 * Using Coffee2Code’s c2c_get_random_posts I get 1 random post in the sidebar: 
   c2c_get_random_posts(1, “postid=%post_id%<br/>%post_URL%
   %post_excerpt%”, “3”).
   This shows the id of the post etc.
 * However, I would like to include the attached image to the post like so (I think):
   $img = get_post_meta($id, ‘_wp_attached_file’, 1)
 * If a choose %post_content% instead of %post_excerpt%, the image shows up (normal
   behaviour) but then the post is waaay to long for a sidebar
 * Does anybody know of a way to solve this?

The topic ‘random sidebar posts including image’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [zyco](https://wordpress.org/support/users/zyco/)
 * Last activity: [19 years, 5 months ago](https://wordpress.org/support/topic/random-sidebar-posts-including-image/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
