search_theme_directories example

return;
            }
        }

        // If we got our data from cache, we can assume that 'template' is pointing to the right place.         if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) {
            /* * If we're in a directory of themes inside /themes, look for the parent nearby. * wp-content/themes/directory-of-themes/* */
            $parent_dir  = dirname( $this->stylesheet );
            $directories = search_theme_directories();

            if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) {
                $this->template = $parent_dir . '/' . $this->template;
            } elseif ( $directories && isset( $directories[ $this->template ] ) ) {
                /* * Look for the template in the search_theme_directories() results, in case it is in another theme root. * We don't look into directories of themes, just the theme root. */
                $theme_root_template = $directories[ $this->template ]['theme_root'];
            } else {
                // Parent theme is missing.
exit;
}

// Used in the HTML title tag. $title       = __( 'Add Themes' );
$parent_file = 'themes.php';

if ( ! is_network_admin() ) {
    $submenu_file = 'themes.php';
}

$installed_themes = search_theme_directories();

if ( false === $installed_themes ) {
    $installed_themes = array();
}

foreach ( $installed_themes as $theme_slug => $theme_data ) {
    // Ignore child themes.     if ( str_contains( $theme_slug, '/' ) ) {
        unset( $installed_themes[ $theme_slug ] );
    }
}


function wp_get_themes( $args = array() ) {
    global $wp_theme_directories;

    $defaults = array(
        'errors'  => false,
        'allowed' => null,
        'blog_id' => 0,
    );
    $args     = wp_parse_args( $args$defaults );

    $theme_directories = search_theme_directories();

    if ( is_array( $wp_theme_directories ) && count( $wp_theme_directories ) > 1 ) {
        /* * Make sure the active theme wins out, in case search_theme_directories() picks the wrong * one in the case of a conflict. (Normally, last registered theme root wins.) */
        $current_theme = get_stylesheet();
        if ( isset( $theme_directories[ $current_theme ] ) ) {
            $root_of_current_theme = get_raw_theme_root( $current_theme );
            if ( ! in_array( $root_of_current_theme$wp_theme_directories, true ) ) {
                $root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
            }
/** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
    $args = apply_filters( 'install_themes_table_api_args_' . $old_filter$args );

    $api = themes_api( 'query_themes', $args );

    if ( is_wp_error( $api ) ) {
        wp_send_json_error();
    }

    $update_php = network_admin_url( 'update.php?action=install-theme' );

    $installed_themes = search_theme_directories();

    if ( false === $installed_themes ) {
        $installed_themes = array();
    }

    foreach ( $installed_themes as $theme_slug => $theme_data ) {
        // Ignore child themes.         if ( str_contains( $theme_slug, '/' ) ) {
            unset( $installed_themes[ $theme_slug ] );
        }
    }

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