WordPress increase number of Recent Posts.
If you want to know how to increase the number of ‘recent posts’ that appear in your WordPress sidebar here’s how you can do it.
The default maximum allowed is 15 – well I would like to have 30, so this will involve a little bit of hacking of WordPress’ PHP but it’s not difficult.
You need to locate the file ‘default-widgets.php’ which you will find in your wp-includes folder. For me because I’m using WordPress 2.8.4 the code I need is on line 542 and 543. The code was as follows:

Changing the default number of recent posts
$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 10;
else if ( $number < 1 ) $number = 1;
else if ( $number > 15 )
$number = 15;
And I just changed the code so that the else if logic would be > 30, like so…
$title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 10;
else if ( $number < 1 )
$number = 1;
else if ( $number > 30 )
$number = 30;
The last thing you have to do is change the max value for the number of recent posts in your WordPress installation.
WordPress Install > Appearance > Widgets > Recent Posts

And just change the value to your new max value ie. 30. Ignore the text that says: (at most 15)
And you’re good to go…
Simon
Related posts:
- WordPress pin text or banner to top of posts?
- Google AJAX Translation not working with WordPress & Artisteer
- “Increase Google Page Rank” It’s official – I now hate Google.
- WordPress database error: [The used table type doesn't support FULLTEXT indexes]
- Ultimate GA doesn’t work with my WordPress theme – Missing urchin.js|Missing _uacct|Missing urchinTracker
- Upgrade WordPress Automatically – The Sauron plugin
- WordPress’ 20 BEST Plugins for Ultimate Blogging.
2 Comments
Leave a Reply
Hot Topics
- Creating a Drupal 6 custom login form – Step by Step tutorial.
- WordPress Contact Form 7 & WP-Mail-SMTP problem solved
- imagecache wrong path – SOLVED!
- 7129/6105195 Edward Leedskalnin’s anti-gravity – How he built Coral Castle.
- How to take Ownership of a Drive, Folder or File in Windows 7
- WordPress widgets not saving or dragging?
- Firefox – update favicon.ico (SOLVED)
- IE emulator for FireFox
- Site off-line The site is currently not available due to technical problems. Please try again later. Thank you for your understanding. (SOLVED!)
- Access denied – Drupal 6.x
Archives
- November 2011
- September 2011
- August 2011
- June 2011
- January 2011
- December 2010
- November 2010
- October 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- January 2009
- December 2008
- August 2008
- June 2008

Thank you very much! It worked!
Hey man thanks a million,I have apx 5-6 hrs over a period of time searching for a fix,your the only one that really did this!