How to increase the number of RSS widget feed items

By default, WordPress allows only the maximum of 20 items in the RSS widget. In many cases, we need more than 20 items, like “Top 25 Free Apps” or “Top 30 Songs in 2011.”

This tutorial will show you how to increase the maximum number of RSS widget feed items without using a plugin.

Step 1: Backup the file /wp-includes/default-widgets.php

Use a FTP program like FileZilla, navigate to the path /wp-includes and make a backup of the file default-widgets.php.

Step 2: Edit the file default-widgets.php

Download the file into your hard drive, then use a text-editor program like Notepad or Notepad++ to open it. There are 4 places you need to edit:

1) Lines 803, 897, and 960:

Change

if ( $items < 1 || 20 < $items )

to

if ( $items < 1 || 100 < $items )

2) Line 917:

Change

for ( $i = 1; $i <= 20; ++$i )

to

for ( $i = 1; $i <= 100; ++$i )

Note 1: You can change to as how many items as you want. In this example, I use 100.

Note 2: Depending on the WordPress version, the line numbers may be different. This tutorial uses WordPress version 3.3.1. Alternately, you can press Ctrl + F on the keyboard and search for the text:

$items < 1 || 20

for lines 803, 897, 960, and:

$i <= 20

for line 917.

Step 3: Upload the file back to your server

Now, when you finish editing, save the file and upload it back to your server. Then, login into admin area, go to Appearance > Widgets. Drag a RSS widget into a sidebar and see the change.

Similar Posts