Opened 6 years ago

Closed 4 years ago

#4131 closed task (blessed) (fixed)

Edit Theme should allow editing files in subfolders

Reported by: drhallows Owned by: ryan
Priority: normal Milestone: 2.8
Component: Themes Version: 2.0.10
Severity: normal Keywords: edit themes has-patch
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 5 years ago.

Download all attachments as: .zip

Change History (19)

  • 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.

  • Keywords edit themes added; theme wordpress removed
  • Milestone changed from 2.4 to 2.3

comment:4 follow-up: ↓ 5   thee176 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]

comment:5 in reply to: ↑ 4   Nazgul6 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.

  • Keywords hunt-inactive added

DD325 years ago

comment:7   DD325 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.

  • Milestone changed from 2.5 to 2.6

See also #6531

  • Component changed from Administration to Themes
  • Owner anonymous deleted
  • Component changed from Themes to Template
  • Owner set to anonymous
  • 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.

  • Type changed from defect (bug) to task (blessed)
  • Owner changed from anonymous to ryan
  • Component changed from Template to Themes

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

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

  • 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.