I want to organize themes like:
wp-content/themes/themeshop/theme1
wp-content/themes/themeshop/theme2
wp-content/themes/themeshop/theme3
Now from my understanding, this organization works perfectly at the folder level. I dropped themes in subdirectories and everything seems to work fine. Now is it possible to duplicate this categorization in the Administration backend on the themes page?
Updated plugin version available at GitHub.
I first saw your Question at [wp-hackers] list, and, after implementing the solution, was about to publish a Q&A for that. Well, it’s already here, and has a bounty put on it 🙂
As Daniel Bachhuber points out in the thread:
I came up with this solution to show that in the backend:
in Multisite, we can add a column in the Themes’ screen and show the info with
manage_themes_custom_column
andmanage_themes-network_columns
.in single sites installations, the only entry point I found was in
theme_action_links
.Result in Multisite:
Folders
/themes/clientes/
and/themes/brasofilo/
). There’s no output in sub-sites of the network.Much probably it’s possible to add a filter here.
Result in a single site:
Multisite not enabled. Folders
/themes/defaults/
and/themes/others/
.This screen is really limited in terms of customization. I agree with @Ralf912 analysis.
Important note: after moving active themes into sub-folders, all sites lose its theme configuration, each site theme has to be set again.
I think you are looking for an action hook or a filter to exclude your themes from the standard list of themes and create an extra list representing the folder structure. Or simplier grouping hemes by the folder they are in.
If you open
wp-admin/themes.php
, you will see there is no action hook or filter. There are also no action hooks or filters in the used functions or the list class (WP_Themes_List_Table
) where you can modify the list of themes.The only thing you can do is recode the complete process of displaying themes on the themes page and replace the link to the
themes.php
in the admin menu to your own script.