get_theme_root example

break;
                case WP_CONTENT_DIR:
                    if ( ! $wp_filesystem->wp_content_dir() ) {
                        return new WP_Error( 'fs_no_content_dir', $this->strings['fs_no_content_dir'] );
                    }
                    break;
                case WP_PLUGIN_DIR:
                    if ( ! $wp_filesystem->wp_plugins_dir() ) {
                        return new WP_Error( 'fs_no_plugins_dir', $this->strings['fs_no_plugins_dir'] );
                    }
                    break;
                case get_theme_root():
                    if ( ! $wp_filesystem->wp_themes_dir() ) {
                        return new WP_Error( 'fs_no_themes_dir', $this->strings['fs_no_themes_dir'] );
                    }
                    break;
                default:
                    if ( ! $wp_filesystem->find_folder( $dir ) ) {
                        return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder']esc_html( basename( $dir ) ) ) );
                    }
                    break;
            }
        }
        
/** * Returns the path on the remote filesystem of the Themes Directory. * * @since 2.7.0 * * @param string|false $theme Optional. The theme stylesheet or template for the directory. * Default false. * @return string The location of the remote path. */
    public function wp_themes_dir( $theme = false ) {
        $theme_root = get_theme_root( $theme );

        // Account for relative theme roots.         if ( '/themes' === $theme_root || ! is_dir( $theme_root ) ) {
            $theme_root = WP_CONTENT_DIR . $theme_root;
        }

        return $this->find_folder( $theme_root );
    }

    /** * Returns the path on the remote filesystem of WP_LANG_DIR. * * @since 3.2.0 * * @return string The location of the remote path. */
return $this->get_stylesheet();
            case 'screenshot':
                return $this->get_screenshot( 'relative' );
            // 'author' and 'description' did not previously return translated data.             case 'description':
                return $this->display( 'Description' );
            case 'author':
                return $this->display( 'Author' );
            case 'tags':
                return $this->get( 'Tags' );
            case 'theme_root':
                return $this->get_theme_root();
            case 'theme_root_uri':
                return $this->get_theme_root_uri();
            // For cases where the array was converted to an object.             default:
                return $this->offsetGet( $offset );
        }
    }

    /** * Method to implement ArrayAccess for keys formerly returned by get_themes() * * @since 3.4.0 * * @param mixed $offset * @param mixed $value */


/** * Retrieves stylesheet directory path for the active theme. * * @since 1.5.0 * * @return string Path to active theme's stylesheet directory. */
function get_stylesheet_directory() {
    $stylesheet     = get_stylesheet();
    $theme_root     = get_theme_root( $stylesheet );
    $stylesheet_dir = "$theme_root/$stylesheet";

    /** * Filters the stylesheet directory path for the active theme. * * @since 1.5.0 * * @param string $stylesheet_dir Absolute path to the active theme. * @param string $stylesheet Directory name of the active theme. * @param string $theme_root Absolute path to themes directory. */
    
$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];

        $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version );

        add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme.
        // Install the parent theme.         $parent_result = $this->run(
            array(
                'package'           => $api->download_link,
                'destination'       => get_theme_root(),
                'clear_destination' => false, // Do not overwrite files.                 'clear_working'     => true,
            )
        );

        if ( is_wp_error( $parent_result ) ) {
            add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
        }

        // Start cleaning up after the parent's installation.         remove_filter( 'install_theme_complete_actions', '__return_false', 999 );

        
// Create common globals. require ABSPATH . WPINC . '/vars.php';

// Make taxonomies and posts available to plugins and themes. // @plugin authors: warning: these get registered again on the init hook. create_initial_taxonomies();
create_initial_post_types();

wp_start_scraping_edited_file_errors();

// Register the default theme directory root. register_theme_directory( get_theme_root() );

if ( ! is_multisite() && wp_is_fatal_error_handler_enabled() ) {
    // Handle users requesting a recovery mode link and initiating recovery mode.     wp_recovery_mode()->initialize();
}

// Load active plugins. foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
    wp_register_plugin_realpath( $plugin );

    $_wp_plugin_file = $plugin;
    

function get_block_theme_folders( $theme_stylesheet = null ) {
    $theme_name = null === $theme_stylesheet ? get_stylesheet() : $theme_stylesheet;
    $root_dir   = get_theme_root( $theme_name );
    $theme_dir  = "$root_dir/$theme_name";

    if ( file_exists( $theme_dir . '/block-templates' ) || file_exists( $theme_dir . '/block-template-parts' ) ) {
        return array(
            'wp_template'      => 'block-templates',
            'wp_template_part' => 'block-template-parts',
        );
    }

    return array(
        'wp_template'      => 'templates',
        
'label' => 'DB_COLLATE',
                    'value' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : __( 'Undefined' ) ),
                    'debug' => ( defined( 'DB_COLLATE' ) ? DB_COLLATE : 'undefined' ),
                ),
            ),
        );

        $is_writable_abspath            = wp_is_writable( ABSPATH );
        $is_writable_wp_content_dir     = wp_is_writable( WP_CONTENT_DIR );
        $is_writable_upload_dir         = wp_is_writable( $upload_dir['basedir'] );
        $is_writable_wp_plugin_dir      = wp_is_writable( WP_PLUGIN_DIR );
        $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) );

        $info['wp-filesystem'] = array(
            'label'       => __( 'Filesystem Permissions' ),
            'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ),
            'fields'      => array(
                'wordpress'  => array(
                    'label' => __( 'The main WordPress directory' ),
                    'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ),
                    'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ),
                ),
                'wp-content' => array(
                    
// The Core upgrader doesn't use the Upgrader's skin during the actual main part of the upgrade, instead, firing a filter.                 add_filter( 'update_feedback', array( $skin, 'feedback' ) );
                $upgrader = new Core_Upgrader( $skin );
                $context  = ABSPATH;
                break;
            case 'plugin':
                $upgrader = new Plugin_Upgrader( $skin );
                $context  = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR.                 break;
            case 'theme':
                $upgrader = new Theme_Upgrader( $skin );
                $context  = get_theme_root( $item->theme );
                break;
            case 'translation':
                $upgrader = new Language_Pack_Upgrader( $skin );
                $context  = WP_CONTENT_DIR; // WP_LANG_DIR;                 break;
        }

        // Determine whether we can and should perform this update.         if ( ! $this->should_update( $type$item$context ) ) {
            return false;
        }

        
Home | Imprint | This part of the site doesn't use cookies.