Opened 15 years ago
Closed 15 years ago
#12195 closed enhancement (worksforme)
add filter for get_themes function
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
Description
Would be nice to have a filter added to the get_themes function so plugin authors can manipulate the theme information before it is passed to the page.
Example:
With the new multisite setup I'll be needing to limit certain themes viewable for certain sites and this would be the most ideal approach.
Attachments (1)
Change History (9)
#1
@
15 years ago
- Keywords has-patch added; add_filter get_themes plugins removed
- Milestone changed from Unassigned to 3.0
#3
@
15 years ago
- Resolution set to duplicate
- Status changed from new to closed
In a network environment the themes can already be filtered with the allowed_themes filter.
#4
@
15 years ago
- Resolution duplicate deleted
- Status changed from closed to reopened
I don't believe this is possible on a per site basis though.
When I say site, I don't mean blog.
Example:
ms-themes.php shows the themes available to that site.
What if I only want certain themes available/visible to certain sites (even to site admins)?
My reasoning:
My Multisite setup has restricted 'Site Admins' so they cannot go beyond the bounds of their 'Site'. If a user's main blog belongs on a different 'Site' they cannot edit all their details or delete them. They also cannot edit blogs that don't reside on their site. I then made it so 'Site Admins' of site_id=1 have full control over everything (how it's currently set up).
What if I want to upload a custom theme on site #1 and I don't even want site #2 to know that it's an option?
I believe this cannot be done without making a filter on the get_themes function.
example code for making a theme available to only one site:
(uses scribu's add_filter patch)
function remove_themes($wp_themes) { // get current site global $current_site; // set themes that are site specific by unsetting them on all other sites if($current_site->id != 1) { // unset theme from array unset($wp_themes['Theme Name']); } // return theme return $wp_themes; } add_filter("get_themes", "remove_themes");
Note that themes can already be disabled/enabled per site via the Network admin.