wp_print_theme_file_tree example

sprintf(
                        '<a href="%s">%s</a>',
                        self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
                        $theme->parent()->display( 'Name' )
                    )
                );
                ?> </li> <?php endif; ?> <li role="treeitem" tabindex="-1" aria-expanded="true" aria-level="1" aria-posinset="1" aria-setsize="1"> <ul role="group"> <?php wp_print_theme_file_tree( wp_make_theme_file_tree( $allowed_files ) ); ?> </ul> </li> </ul> </div> <?php if ( $error ) :
    echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
else :
    ?> <form name="template" id="template" action="theme-editor.php" method="post">
function wp_print_theme_file_tree( $tree$level = 2, $size = 1, $index = 1 ) {
    global $relative_file$stylesheet;

    if ( is_array( $tree ) ) {
        $index = 0;
        $size  = count( $tree );

        foreach ( $tree as $label => $theme_file ) :
            $index++;

            if ( ! is_array( $theme_file ) ) {
                wp_print_theme_file_tree( $theme_file$level$index$size );
                continue;
            }
            ?> <li role="treeitem" aria-expanded="true" tabindex="-1" aria-level="<?php echo esc_attr( $level ); ?>" aria-setsize="<?php echo esc_attr( $size ); ?>" aria-posinset="<?php echo esc_attr( $index ); ?>"> <span class="folder-label"><?php echo esc_html( $label ); ?> <span class="screen-reader-text"> <?php                     /* translators: Hidden accessibility text. */
                    _e( 'folder' );
                    
Home | Imprint | This part of the site doesn't use cookies.