0

In web development, I get used to place css/js files under separate folders (css folder, js folder ..etc).

What I am experiencing in WordPress is that I cannot access these folders in WordPress Admin Editor Page, the editor only displays the files under the main theme folder, not the nested folders.

Is there an option to enable showing nested folders? is there a plugin to accomplish that? If not, then what is the best practice to follow for placing files and folders under WordPress folder?

1 Answer 1

1

The theme editor is located under /wp-admin/theme-editor.php and uses get_current_theme(); to give you the first files to edit. From the returned array of theme data, it uses 'Template Dir' to locate the directory and 'Template Files' to give you a list of files to edit (loops through the files with a foreach loop). For stylesheets it uses 'Stylesheet Dir' and 'Stylesheet Files' to loop through.

Point is that:

1. there are no filters or hooks, so you'd need to modify core directly (which is not recommended, as your changes would be overwritten on update) and

2. you'd need to write a function that reads the whole folder, finds all subfolders and then another one to find all containing files and last loop through them too.

2
  • Okay, so there is no plugin already built to address this functionality? Commented Oct 9, 2011 at 17:18
  • No and no: No plugin and no action filter/hook to use a plugin. Commented Oct 9, 2011 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.