WordPress - Show more than 15 recent posts

This tutorial explains how to modify the WordPress recent posts sidebar widget entry to display more than 15 recent posts. By default the number of posts to show is (at most 15). Maybe you want to display 20 recent posts? Or more? I'll show you how.


WordPress - How to display or show more than 15 recent posts:

  1. Using your favorite FTP application, navigate to your wp-includes directory on your server and copy widgets.php to your PC
  2. Using Notepad ++ open widgets.php and find the following:
  3. $title = empty($options['title']) ? __('Recent Posts') : $options['title'];
    if ( !$number = (int) $options['number'] )
    $number = 10;
    else if ( $number < 1 )
    $number = 1;
    else if ( $number > 15 )
    $number = 15;

  4. Change 15 to 20 to display up to 20 posts
  5. Next find the first occurance of the following:
  6. at most 15

  7. Change to at most 20
  8. Save your widgets.php file and upload overwriting the old file on the server
  9. Now when you go to your Design-> Widgets section, you'll have the ability to set your recent posts to the max value you set in step 3.