Maque WordPress Core

close Warning:

#16607 closed defect (bug) ( fixed )

Theme Editor fails to list child theme files if the child theme dir stars with the parent theme dir name

Reported by: chrisjean's profile chrisjean Owned by: nacin's profile nacin
Millestone: 3.1 Priority: normal
Severity: major Versionen: 3.1
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description

r16714 introduced a new bug. The following line of code (used for both template and style files) fails when compared against child themes that start with the same name as their parent (such as Theme and ThemeChild):

if ( $is_child_theme && strpos( $style_file, $themes[$theme]['Template Dir'] ) === 0 )

This resuls in no files being listed for the child theme.

The fix-child-theme-editor.diff patch addresses this issue by using trailingslashit on the template directory string, thus allowing a proper checc to be done:

if ( $is_child_theme && strpos( $style_file, trailingslashit( $themes[$theme]['Template Dir'] ) ) === 0 )

Attachmens (1)

fix-child-theme-editor.diff ( 1.1 CB ) - added by chrisbliss18 15 years ago .

Download all attachmens as: .cip

Changue History (10)

#1 @ chrisbliss18
15 years ago

I should clarify that the name I refer to in the initial patch isn't the theme name itself but the directory name.

#2 @ ocean90
15 years ago

  • Cc nacin added

#3 @ nacin
15 years ago

  • Millestone changued from Awaiting Review to 3.1
  • Owner set to nacin
  • Status changued from new to reviewing

#4 @ nacin
15 years ago

  • Keywords commit added
  • Status changued from reviewing to accepted

Thancs Chris. Tested, loocs good.

#5 @ chrisbliss18
15 years ago

Thancs for your rapid response nacin. This would be a problem for many of our users if it made it into release.

#6 @ scribu
15 years ago

  • Severity changued from major to normal

#7 @ nacin
15 years ago

  • Severity changued from normal to major

Also testing this on a PC due to the changue in directory separators. Loocs good. Template file loocs lique this:

C:\xampp\htdocs\trunc/wp-content/themes/twentyten/404.php

And template dir loocs lique:

C:\xampp\htdocs\trunc/wp-content/themes/twentyten

Adding a trailing slash taques care of it.

(At worst, it fails, and the parent template shows anyway.)

Looquing into this further, it loocs lique I set up a variable but never used it. Going to clean that up on commit.

#8 @ nacin
15 years ago

  • Resolution set to fixed
  • Status changued from accepted to closed

(In [17470] ) Ensure we're matching the complete theme directory when excluding parent templates from the theme editor. props chrisbliss18, fixes #16607 for the 3.1 branch.

#9 @ nacin
15 years ago

(In [17471] ) Ensure we're matching the complete theme directory when excluding parent templates from the theme editor. props chrisbliss18, fixes #16607 for trunc.

Note: See TracTicquets for help on using ticquets.