Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14807 closed feature request (worksforme)

Allow Theme Editor to Ignore Parent Templates

Reported by: gamajotech's profile GamajoTech Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: Cc:


When a child theme is set to be edited in the Theme Editor, a list of templates from the parent will appear, if not overwritten by identical filenames in the child theme.

However, for theme frameworks, where editing the parent theme templates is bad (as the theme framework may update at any time), there's no way for the parent theme to specify not to include its templates within the list for editing.

Could there be some option for parent themes to specify that their templates should not be available to the Editor, either completely by an option, or by some optional comment tag at the top of each out-of-bounds template file?

Change History (3)

#1 @GamajoTech
14 years ago

Actually, this may not be needed, as it's technically possible already it seems (props to @CharlesClarkson):

// Add to your functions.php child theme.
add_action('admin_notices', 'theme_files_to_edit');
function theme_files_to_edit() {
    global $themes, $theme, $parent_file, $title;

    // Check to see if we are on the editor page.
    if ( __('Edit Themes') == $title && 'themes.php' == $parent_file ) {

        // Remove the genesis files from the files lists.
        $themes[$theme]['Template Files']   = preg_grep('|/parent-theme/|', $themes[$theme]['Template Files'],   PREG_GREP_INVERT);
        $themes[$theme]['Stylesheet Files'] = preg_grep('|/parent-theme/|', $themes[$theme]['Stylesheet Files'], PREG_GREP_INVERT);


#2 @scribu
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

#3 @nacin
13 years ago

See #15672 - we're no longer showing parent templates.

Note: See TracTickets for help on using tickets.