[wp-hackers] Hiding Child's Template Theme
Matt Martz
mdmartz at sivel.net
Mon Mar 30 13:58:08 GMT 2009
On Mon, Mar 30, 2009 at 9:46 AM, Chris Jean <gaarai at gaarai.com> wrote:
> I'm starting to play around with child themes and wondered if it is possible
> to hide the parent or template theme of a child theme in Manage Themes.
>
> Looking through the code, it looks like the only way to have a theme removed
> is if it is broken (missing parent theme, missing index.php or style.css,
> etc). Even then, it lists them as broken themes.
>
> My reasoning for wanting to hide the parent theme is simple: I don't want a
> user to activate the parent theme if the child theme was the one customized
> or built for their needs. Looking at almost any information about building
> child themes has a note about not activating the parent instead of the
> child. So, I can't be the only one that sees the listing of parent themes
> problematic.
>
> I'm thinking of building a patch for core that allows for an entry in the
> theme information that tells WordPress to hide the theme from activation on
> Manage Themes. For example:
>
> Theme Name: Parent Theme
> Theme URI: http://wordpress.org
> Author: Chris
> Author URI: http://site.com
> Version: 1.0
> Description: This is a parent theme and should not be used.
> *Hidden: yes*
>
> Of course, a different option could be used instead of "Hidden:", and I'm
> open to suggestions.
>
> I'm passing this by the list first to see 1) how many other developers are
> interested in my proposal and 2) if any other developers have any
> suggestions or recommendations.
>
> --
> Chris Jean
> http://gaarai.com/
> http://wp-roadmap.com/
> http://dnsyogi.com/
>
Perhaps adding a filter in wp-admin/themes.php for $themes =
get_themes(); so that you can hook into it from the child themes
functions.php and remove the parent theme from the return.
Maybe:
$themes = apply_filters('get_themes', get_themes());
Then you could do:
add_filter('get_themes', 'remove_parent');
function remove_parent($themes) {
return unset($themes['parent_name']);
}
--
Matt Martz
matt at sivel.net
http://sivel.net/
More information about the wp-hackers
mailing list