Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#8236 closed defect (bug) (fixed)

Child theme template files not showing up in Theme editor

Reported by: roganty's profile roganty Owned by: westi's profile westi
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: Themes Keywords: has-patch needs-testing
Focuses: Cc:

Description

The enhancements to child themes is great.

I have created a child theme and have copied a couple of the parent template files to the child directory so that I could make a few little changes.
I was working with a file editor and uploading the changes via ftp.

I went to change one small detail in one of the files with the theme editor from the dashboard, but the file it displayed was from the parent theme and not the child theme.

If the child's theme template files are able to override the parent's theme template files, then how come this isn't happening with the theme editor?

The changes I have made are being reflected in the style, and none of the changes have been applied to the parent template files by mistake.

Attachments (4)

theme-editor.php.patch (317 bytes) - added by roganty 17 years ago.
theme-editor.diff (1.4 KB) - added by roganty 17 years ago.
This is a better patch for theme-editor.php
theme-editor2.diff (1.4 KB) - added by roganty 16 years ago.
Updated patch for theme-editor.php revision 9903
blue-matter.zip (55.8 KB) - added by roganty 16 years ago.
A child theme of Grey Matter (see comment 11)

Download all attachments as: .zip

Change History (17)

#1 @roganty
17 years ago

  • Milestone changed from 2.8 to 2.7

#2 @roganty
17 years ago

Ok, I think I have found where the problem is occurring

It is in the file /wp-admin/theme-editor.php

	$template_mapping = array();
	foreach($themes[$theme]['Template Files'] as $template_file) {
		$description = trim( get_file_description($template_file) );
		$template_show = basename($template_file);
		$filedesc = ( $description != $template_file ) ? "$description <span class='nonessential'>($template_show)</span>" : "$description";
		$filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($template_show)</span></span>" : $filedesc;
		$template_mapping[ $description ] = array( $template_file, $filedesc );
	}
	ksort( $template_mapping );

What is needed is to check if the file has already been added.

I'll have a go and see if I can come up with something.

@roganty
17 years ago

This is a better patch for theme-editor.php

#3 @roganty
17 years ago

Ok, I think I've done it.

Please use theme-editor.diff, as theme-editor.php.patch was my first attempt, and also my first attempt at using diff!

#4 @roganty
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

#5 @DD32
17 years ago

  • Keywords has-patch added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Tickets remain open until the fix is commited to SVN.

#6 @roganty
17 years ago

  • Keywords needs-testing added
  • Owner set to roganty
  • Status changed from reopened to new

#7 @roganty
16 years ago

  • Keywords child theme theme editor themes removed

#8 @westi
16 years ago

  • Owner changed from roganty to westi
  • Status changed from new to assigned

I will try and test and review this before RC

If not it will have to wait for 2.7.1

@roganty
16 years ago

Updated patch for theme-editor.php revision 9903

#9 follow-up: @roganty
16 years ago

Thanks westi

I have just uploaded an updated patch that uses revision 9903

#10 in reply to: ↑ 9 ; follow-up: @westi
16 years ago

Replying to roganty:

Thanks westi

I have just uploaded an updated patch that uses revision 9903

Pointers to an example theme that uses this feature will speed up my testing ;-)

#11 in reply to: ↑ 10 @roganty
16 years ago

Replying to westi:

Pointers to an example theme that uses this feature will speed up my testing ;-)

Westi, What do you need?

All you need is a child theme.

The child theme that I am using overrides a few of the files from the parent theme. eg, header.php

And the files listed in the theme editor are all from the parent theme, the only files that show up from the child theme is style.css and any files not found in the parent theme.

The parent theme I am using is called Grey Matter, and the child theme is my own which I'm calling Blue Matter.

To suit my needs better I copied some of the files from Grey Matter to my own theme and changed those files.

Comment 4 in ticket:7086 mentions this problem, hopefully this is a solution!

@roganty
16 years ago

A child theme of Grey Matter (see comment 11)

#12 @roganty
16 years ago

Blue Matter requires the URI Crumb Plugin

#13 @westi
16 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10047]) Ensure that the theme-editor displays the correct files when a child theme overrides templates. Fixes #8236 props roganty.

Note: See TracTickets for help on using tickets.