The thing you need to do is update the filter with the “allowed” editor file types.
Here’s what you’ll need for TWIG:
function add_custom_editor_file_types( $types ) {
$types[] = 'twig';
return $types;
}
add_filter( 'wp_theme_editor_filetypes', 'add_custom_editor_file_types' );
Of course, you can add any file type/extension you wish in the same manner. The editor UI will show the directory structure only where there are “editable” files.
EDIT:
Certain directories are excluded from being scanned for files, by default. One of these is vendor
. This is likely because in some instances, the vendor
dir will be huge and so loading and processing for this will have a cost associated with it.
To prevent vendor
dir from being excluded, you can use the filter dedicated for that purpose:
function unexclude_theme_editor_dirs( $exclusions ) {
// default exclusions: 'CVS', 'node_modules', 'vendor', 'bower_components'
$unExclude = [ 'vendor' ];
return array_diff( $exclusions, $unExclude );
}
add_filter( 'theme_scandir_exclusions', 'unexclude_theme_editor_dirs' );