Increase the number of Recent Posts or Previous posts in WordPress
Recent post is a section which displays on the footer or on the side bar of your wordpress. This highlights the subject or heading of your posts. This is a useful widget which helps the reader to navigate to other posts in your website.
With the new wordpress 2.8.3 the number of previous posts allowed in 15. Which means it will show upto 15 of the most recent posts. But if you had noticed, revious posts on my blog shows more than 15. Actually I have set it to show upto 50 , just to accomodate future blogs too.
In the latest wordpress this feature can be altered at the wp-includes/default-widgets.php. You will need to change a code value in this page and then make changes at the admin too. Its an easy tweak and virtually nothing can go wrong if followed the instructions carefully..
***BACKUP FILES BEFORE YOU PROCEED..I AM NOT RESPONSIBLE FOR ANY CHANGES YOU DO ON YOUR FILES***
Go to the wp-includes then find the file default-widgets.php . Open this up in a HTML editor or just a word pad.
Find the following code:
$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;
Becareful that if your blogs grow over the time, this can deteriorate the speed of your website since query in the code needs to pull up all these postings. So as a thumb of rule, refrain from putting any number higer than 100
Change the value of 15 to any number you choose, I have opted for 50 , so the altered code will look like this to me
$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 > 50 ) $number = 50;
Now upload the changes to server, to overwrite the previous files.
Login to the admin of your wordpress, go to Appreances/Widgets/
If you have set your widget to show on side bar or footer, open that up and change the number to 50 or less.
You will see that the recent posts shows that many posts in the widget.
Hope you find it useful…