WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 9 years ago

#4131 closed task (blessed) (fixed)

Edit Theme should allow editing files in subfolders

Reported by: drhallows Owned by: ryan
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.0.10
Component: Themes Keywords: edit themes has-patch
Focuses: Cc:

Description

I have noticed an error that occurs while editing themes from Wordpress' control panel. If there are folders inside the theme folder (i.e. theme/widgets/) the 'widgets' folder is not listed..

Attachments (1)

4131.diff (2.4 KB) - added by DD32 10 years ago.

Download all attachments as: .zip

Change History (19)

#1 @foolswisdom
11 years ago

  • Milestone changed from 2.0.11 to 2.4
  • Summary changed from Editing subfolders of a Wordpress Theme to Edit Theme should allow editing files in subfolders

ENV: WP trunk (2.2) r5237
Reproduced bug using default theme. At wp-admin/theme-editor.php I do not see default/images/header-img.php in the list.

#2 @foolswisdom
11 years ago

  • Keywords edit themes added; theme wordpress removed

#3 @rob1n
11 years ago

  • Milestone changed from 2.4 to 2.3

#4 follow-up: @thee17
11 years ago

Looking at the code the problem would be with

wp-admin/theme-editor.php on line 21

$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);

This appears to be where the file list is called, maybe it might be possible to follow the sub folders of $themes[$theme]

#5 in reply to: ↑ 4 @Nazgul
11 years ago

  • Milestone changed from 2.3 to 2.4

Replying to thee17:

Looking at the code the problem would be with wp-admin/theme-editor.php on line 21

No, the problem is inside get_themes(), which is called on line 9.

#6 @thee17
10 years ago

  • Keywords hunt-inactive added

@DD32
10 years ago

#7 @DD32
10 years ago

  • Keywords has-patch added; hunt-inactive removed

Patch allows get_themes to see Template files in sub-dirs, Has the main impact of allowing the theme editor to view them.

As a side effect of allowing get_themes() to return template files in subdirectories(only a single level -- And stylesheets are not looked for), Templates could exist in the folder, Under the current situation template files can only exist within the main theme directory.

As such, I added a function theme_basename() it basically returns the path of a file relitive to its theme directory, ie. theme_basename('wp-content/themes/my-theme/extra-templates/template1.php') will return 'extra-templates/template1.php'. That allows for the templates to continue working correctly.

Templates can now exist in those subdirectories.

#8 @thee17
10 years ago

  • Milestone changed from 2.5 to 2.6

#9 @mrmist
9 years ago

See also #6531

#10 @thee17
9 years ago

  • Component changed from Administration to Themes
  • Owner anonymous deleted

#11 @thee17
9 years ago

  • Component changed from Themes to Template
  • Owner set to anonymous

#12 @navjotjsingh
9 years ago

  • Milestone changed from 2.9 to 2.8

Seeing recent changes in editing capabilites in 2.8 coming, shouldn't this also get fixed in 2.8 Any progress? I would love to see this too...its tiring to edit some files via FTP and remaining via WP-Admin..it would be good if I could edit right from dashboard now that syntax highlighting is also there.

#13 @ryan
9 years ago

  • Type changed from defect (bug) to task (blessed)

#14 @ryan
9 years ago

  • Owner changed from anonymous to ryan

#15 @ryan
9 years ago

  • Component changed from Template to Themes

#16 @zeronex
9 years ago

would be nice to allow Full screen mode, similar to post editing.

#17 @zeronex
9 years ago

and additionally it would be cool to have API lookup AJAX based for quick lookup.

#18 @ryan
9 years ago

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

(In [10835]) Show template files in subdirs. Props DD32. fixes #4131

Note: See TracTickets for help on using tickets.