Title: Recent Posts PHP
Last modified: August 20, 2016

---

# Recent Posts PHP

 *  [silkweb](https://wordpress.org/support/users/silkweb/)
 * (@silkweb)
 * [14 years ago](https://wordpress.org/support/topic/recent-posts-php/)
 * Hello Everyone, I hope someone can assist. I have modified a php string on my
   homepage to show the recent posts but I cannot for the life of me figure out 
   how to reduce the # of posts to 4 and change the title. Here is my code:
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   The maximum number of lines of code that you can post in these forums is **ten
   lines**. Please use the [pastebin](http://wordpress.pastebin.com/)]_

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

 *  Thread Starter [silkweb](https://wordpress.org/support/users/silkweb/)
 * (@silkweb)
 * [14 years ago](https://wordpress.org/support/topic/recent-posts-php/#post-2793817)
 * [http://pastebin.com/9GykQLhx](http://pastebin.com/9GykQLhx)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years ago](https://wordpress.org/support/topic/recent-posts-php/#post-2793822)
 * `<?php the_widget('WP_Widget_Recent_Posts', array('number' => 4), $args); ?>`
   
   or: `<?php the_widget('WP_Widget_Recent_Posts', 'number=4', $args); ?>`
 * [http://codex.wordpress.org/Function_Reference/the_widget#Recent_Posts_widget](http://codex.wordpress.org/Function_Reference/the_widget#Recent_Posts_widget)
   
   [http://codex.wordpress.org/Function_Reference/the_widget](http://codex.wordpress.org/Function_Reference/the_widget)
 * > **instance **
   >  (array or query-string-style) the widget’s instance settings.
   > See each widget below.
 *  Thread Starter [silkweb](https://wordpress.org/support/users/silkweb/)
 * (@silkweb)
 * [14 years ago](https://wordpress.org/support/topic/recent-posts-php/#post-2793824)
 * Thanks very much, I did find both those links and I did read everything that 
   was there about doing this, but it doesn’t give examples of how it is to be presented
   and not very intuitive. Can you advise what I would do if I wanted to change 
   the title because right now is it called “Recent Posts”, or if I wanted to remove
   the title completely?
 * Thank you so much!
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years ago](https://wordpress.org/support/topic/recent-posts-php/#post-2793832)
 *     ```
       <?php the_widget('WP_Widget_Recent_Posts', array('number' => 4, 'title' => 'Some Other Title'), $args); ?>
       ```
   
 * or you could try with a single space character as title – however this will still
   output the ‘before_title’ and ‘after_title’ html tags:
 *     ```
       <?php the_widget('WP_Widget_Recent_Posts', array('number' => 4, 'title' => ' '), $args); ?>
       ```
   
 * or to get rid of the html title tags and show no title:
 *     ```
       <?php the_widget('WP_Widget_Recent_Posts', array('number' => 4, 'title' => ' '), array('before_title' => '', 'after_title' => '')); ?>
       ```
   
 *  Thread Starter [silkweb](https://wordpress.org/support/users/silkweb/)
 * (@silkweb)
 * [14 years ago](https://wordpress.org/support/topic/recent-posts-php/#post-2793851)
 * Thank you again for your help and fast response. 🙂

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

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [silkweb](https://wordpress.org/support/users/silkweb/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/recent-posts-php/#post-2793851)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
