Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#19469 closed enhancement (duplicate)

The wp-admin theme chooser has a hard coded limit (of 15) and no filter

Reported by: willshouse Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords: has-patch
Focuses: Cc:


I have a lot of themes in my test wordpress site. I get a little frustrated that I can't show more than 15 at a time.


In pages and posts you can click "screen options" to choose the number, but "Themes" has no such option.


It's hardcoded into the WP_Themes_List_Table class that's responsible on Line 50:

$per_page = 15;

It would be fantastic if we could get a "screen options" coded into the Themes page, or at the very minimum add a filter to the per_page variable.

Attachments (1)

19469.diff (1.5 KB) - added by solarissmoke 4 years ago.
Add per_page screen option to themes.php

Download all attachments as: .zip

Change History (22)

#1 @willshouse
4 years ago

Please ignore the part where I mention the variable name and that it is on line 50. I was looking at 3.2 source by mistake. The part about requesting to have a "screen options" menu still stands, and if someone could fill me in on if there is a filter or way to modify the number (which is actually now 24 and not 15 in 3.3, that would be great.

#2 @nacin
4 years ago

  • Version changed from 3.3 to 2.7

I thought we were going to bump it to 30 or 36. We should do that in the future.

Anyway, I think the reason why it is not editable is because it used to be rendered via a <table> and was specifically a 5x3 grid.

Now that it is a div-based grid that is responsive to the width of the screen, it could be added. People (with OCD, I suppose) might have a desire to do the math to ensure the grid is maintained, but that's about it.

#3 @willshouse
4 years ago

Hmm, well even with 24 and using the <div> tag can break on a large monitor like mine where I can see 5 themes across - the last row has four. It would be nice to add a filter to that number. I don't like modifying the core files but I want to see more than 24 on my dev box :)

Thanks for fixing the version number.

#4 @helenyhou
4 years ago

I thought that I had bumped it to 36 on both installed and search, but I guess it's 24 on installed and 36 on search for some now-unknown reason. I like the idea of adding the screen option, though. Then other people can choose whether or not they want to be OCD about it and it won't come from me.

#5 @scribu
4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

+1 for screen option.

#6 @willshouse
4 years ago

yes, the screen option would be great. also I suppose that means the count would be stored in wp_options and I could figure out a way to set that automatically on my dev machine.

#7 @scribu
4 years ago

Actually, it would be stored in usermeta, but yeah, you can filter it either way.

#8 @Utkarsh
4 years ago

  • Cc admin@… added

4 years ago

Add per_page screen option to themes.php

#9 @solarissmoke
4 years ago

  • Keywords has-patch added; needs-patch removed

How does this look?

#10 @scribu
4 years ago

  • Milestone changed from Future Release to 3.4

It looks good.

#11 @helenyhou
4 years ago

#19815 would probably make this irrelevant, especially since screen options require JS.

#12 @scribu
4 years ago

I don't think so. You should still be able to go directly to a certain page of themes through the URL, which would be influenced by how many there are per page.

#13 follow-up: @pagesimplify
4 years ago

Not sure if it's counterproductive to add code changes here. I was about to submit this as a ticket until I saw this reported. Slap me on the hand as a first time offender if I'm going about this wrong.

References apply to WordPress 3.3.1

Change 1: Replace line with call to base class method using 'themes_per_page'.
Modify File: /wp-admin/includes/class-wp-themes-list-table.php

Replace line 50 seen below:

		$per_page = 24;

With the following line:

		$per_page = $this->get_items_per_page( 'themes_per_page', 24 );

This is consistent with the prepare_items() functions used in:

  • Plugins: /wp-admin/includes/class-wp-plugins-list-table.php
  • MS Themes: /wp-admin/includes/class-wp-ms-themes-list-table.php

Change 2: Add Screen Options for themes_per_page for non network installation.
Modify File: /wp-admin/themes.php

Replace line 69 seen below:


With the following lines:

add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' ), 'default' => 24 ) );

Change 3: Handle post back for saving themes per page.
Modify File: /wp-admin/includes/misc.php

Replace line 350 seen below:

			case 'plugins_per_page':

With the following lines:

			case 'plugins_per_page':
			case 'themes_per_page':

Final Note:
By implementing this modification, the following filter will effectively be called:

        apply_filters( 'themes_per_page', $per_page );

From class WP_List_Table

	function get_items_per_page( $option, $default = 20 )

in the file: /wp-admin/includes/class-wp-list-table.php

#14 in reply to: ↑ 13 @pagesimplify
4 years ago

Nevermind, I now see solarissmoke's patch... yeah... so, I need to learn to do that (blush)

#15 @ryan
4 years ago

Just make it something large like 200. We incur the overhead of get_themes() no matter how many are displayed on the page.

#16 follow-up: @scribu
4 years ago

Then how about setting it to 999, like we do for plugins?

#17 in reply to: ↑ 16 ; follow-up: @helenyhou
4 years ago

Replying to scribu:

Then how about setting it to 999, like we do for plugins?

ticket:19815:19815.5.diff does that for installed themes.

#18 @imshashank
4 years ago

Nice thought.. it would be great if the themes are paged as well..

#19 in reply to: ↑ 17 ; follow-up: @imshashank
4 years ago

yes, that's a nice answer.. When we can why shouldn't we .. But is it fesible to make it to 999 . As the plugins take very less space and are shown as list . We can show a lot more plugins than themes in the admin panel.

Replying to helenyhou:

Replying to scribu:

Then how about setting it to 999, like we do for plugins?

ticket:19815:19815.5.diff does that for installed themes.

#20 in reply to: ↑ 19 @helenyhou
4 years ago

Replying to imshashank:

999 per page for installed themes, along with infinite scroll, is now in trunk. See #19815

#21 @scribu
4 years ago

  • Milestone 3.4 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Going to close this as dup of #19815, since that's where all the activity is anyway.

Note: See TracTickets for help on using tickets.