Title: Show Recent Posts Widget
Last modified: August 30, 2016

---

# Show Recent Posts Widget

 *  [bigabig](https://wordpress.org/support/users/bigabig/)
 * (@bigabig)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/show-recent-posts-widget/)
 * Hey guys,
    I want to develop a widget that shows the most recent posts. For some
   reason the following code doesn’t format the post content… (The post content 
   is displayed without any formatting like <p></p> or  etc.)
 *     ```
       /**
            * Outputs the HTML for this widget.
            *
            * @param array  An array of standard parameters for widgets in this theme
            * @param array  An array of settings for this widget instance
            * @return void Echoes it's output
            **/
           public function widget( $args, $instance )
           {
               // Add any html to output the image in the $instance array´
   
       		$count = (!empty( $new_instance['count'] )) ? $new_instance['count'] : 1;
   
       		$args2 = array(
       			'numberposts' => $count,
       			'orderby' => 'post_date',
       			'order' => 'DESC',
       			'post_type' => 'post',
       			'post_status' => 'draft, publish, future, pending, private',
       			'suppress_filters' => false );
   
       		$recent_posts = wp_get_recent_posts( $args2, OBJECT );
   
       		foreach( $recent_posts as $recent ){
       		?>
       			<h1><?php echo $recent->post_title ?></h1>
       			<div class='entry-content'>
       			<p>
       			<span class="entry-date"><?php echo get_the_date("F Y", $recent->id); ?></span><br/>
       			<?php echo $recent->post_content;  ?>
       			</p>
       			</div>
       		<?php
       		}
           }
       ```
   
 * Can someone help me?

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/show-recent-posts-widget/#post-6368914)
 * `<?php echo apply_filters( 'the_content', $recent->post_content ); ?>`

Viewing 1 replies (of 1 total)

The topic ‘Show Recent Posts Widget’ is closed to new replies.

## Tags

 * [content](https://wordpress.org/support/topic-tag/content/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [show](https://wordpress.org/support/topic-tag/show/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/show-recent-posts-widget/#post-6368914)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
