make_site_theme

The timeline below displays how wordpress function make_site_theme has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.4

/**
 * Creates a site theme.
 *
 * {@internal Missing Long Description}}
 *
 * @since 1.5.0
 *
 * @return string|false
 */
function make_site_theme()
{
    // Name the theme after the blog.
    $theme_name = __get_option('blogname');
    $template = sanitize_title($theme_name);
    $site_dir = WP_CONTENT_DIR . "/themes/{$template}";
    // If the theme already exists, nothing to do.
    if (is_dir($site_dir)) {
        return false;
    }
    // We must be able to write to the themes dir.
    if (!is_writable(WP_CONTENT_DIR . '/themes')) {
        return false;
    }
    umask(0);
    if (!mkdir($site_dir, 0777)) {
        return false;
    }
    if (file_exists(ABSPATH . 'wp-layout.css')) {
        if (!make_site_theme_from_oldschool($theme_name, $template)) {
            // TODO: rm -rf the site theme directory.
            return false;
        }
    } else if (!make_site_theme_from_default($theme_name, $template)) {
        // TODO: rm -rf the site theme directory.
        return false;
    }
    // Make the new site theme active.
    $current_template = __get_option('template');
    if (WP_DEFAULT_THEME == $current_template) {
        update_option('template', $template);
        update_option('stylesheet', $template);
    }
    return $template;
}

WordPress Version: 5.1

/**
 * Creates a site theme.
 *
 * {@internal Missing Long Description}}
 *
 * @since 1.5.0
 *
 * @return false|string
 */
function make_site_theme()
{
    // Name the theme after the blog.
    $theme_name = __get_option('blogname');
    $template = sanitize_title($theme_name);
    $site_dir = WP_CONTENT_DIR . "/themes/{$template}";
    // If the theme already exists, nothing to do.
    if (is_dir($site_dir)) {
        return false;
    }
    // We must be able to write to the themes dir.
    if (!is_writable(WP_CONTENT_DIR . '/themes')) {
        return false;
    }
    umask(0);
    if (!mkdir($site_dir, 0777)) {
        return false;
    }
    if (file_exists(ABSPATH . 'wp-layout.css')) {
        if (!make_site_theme_from_oldschool($theme_name, $template)) {
            // TODO: rm -rf the site theme directory.
            return false;
        }
    } else if (!make_site_theme_from_default($theme_name, $template)) {
        // TODO: rm -rf the site theme directory.
        return false;
    }
    // Make the new site theme active.
    $current_template = __get_option('template');
    if ($current_template == WP_DEFAULT_THEME) {
        update_option('template', $template);
        update_option('stylesheet', $template);
    }
    return $template;
}

WordPress Version: 4.2

/**
 * Creates a site theme.
 *
 * {@internal Missing Long Description}}
 *
 * @since 1.5.0
 *
 * @return false|string
 */
function make_site_theme()
{
    // Name the theme after the blog.
    $theme_name = __get_option('blogname');
    $template = sanitize_title($theme_name);
    $site_dir = WP_CONTENT_DIR . "/themes/{$template}";
    // If the theme already exists, nothing to do.
    if (is_dir($site_dir)) {
        return false;
    }
    // We must be able to write to the themes dir.
    if (!is_writable(WP_CONTENT_DIR . "/themes")) {
        return false;
    }
    umask(0);
    if (!mkdir($site_dir, 0777)) {
        return false;
    }
    if (file_exists(ABSPATH . 'wp-layout.css')) {
        if (!make_site_theme_from_oldschool($theme_name, $template)) {
            // TODO: rm -rf the site theme directory.
            return false;
        }
    } else if (!make_site_theme_from_default($theme_name, $template)) {
        // TODO: rm -rf the site theme directory.
        return false;
    }
    // Make the new site theme active.
    $current_template = __get_option('template');
    if ($current_template == WP_DEFAULT_THEME) {
        update_option('template', $template);
        update_option('stylesheet', $template);
    }
    return $template;
}

WordPress Version: 4.1

// Create a site theme from the default theme.
/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since 1.5.0
 *
 * @return false|string
 */
function make_site_theme()
{
    // Name the theme after the blog.
    $theme_name = __get_option('blogname');
    $template = sanitize_title($theme_name);
    $site_dir = WP_CONTENT_DIR . "/themes/{$template}";
    // If the theme already exists, nothing to do.
    if (is_dir($site_dir)) {
        return false;
    }
    // We must be able to write to the themes dir.
    if (!is_writable(WP_CONTENT_DIR . "/themes")) {
        return false;
    }
    umask(0);
    if (!mkdir($site_dir, 0777)) {
        return false;
    }
    if (file_exists(ABSPATH . 'wp-layout.css')) {
        if (!make_site_theme_from_oldschool($theme_name, $template)) {
            // TODO: rm -rf the site theme directory.
            return false;
        }
    } else if (!make_site_theme_from_default($theme_name, $template)) {
        // TODO: rm -rf the site theme directory.
        return false;
    }
    // Make the new site theme active.
    $current_template = __get_option('template');
    if ($current_template == WP_DEFAULT_THEME) {
        update_option('template', $template);
        update_option('stylesheet', $template);
    }
    return $template;
}

WordPress Version: 3.7

// Create a site theme from the default theme.
/**
 * {@internal Missing Short Description}}
 *
 * {@internal Missing Long Description}}
 *
 * @since 1.5.0
 *
 * @return unknown
 */
function make_site_theme()
{
    // Name the theme after the blog.
    $theme_name = __get_option('blogname');
    $template = sanitize_title($theme_name);
    $site_dir = WP_CONTENT_DIR . "/themes/{$template}";
    // If the theme already exists, nothing to do.
    if (is_dir($site_dir)) {
        return false;
    }
    // We must be able to write to the themes dir.
    if (!is_writable(WP_CONTENT_DIR . "/themes")) {
        return false;
    }
    umask(0);
    if (!mkdir($site_dir, 0777)) {
        return false;
    }
    if (file_exists(ABSPATH . 'wp-layout.css')) {
        if (!make_site_theme_from_oldschool($theme_name, $template)) {
            // TODO: rm -rf the site theme directory.
            return false;
        }
    } else if (!make_site_theme_from_default($theme_name, $template)) {
        // TODO: rm -rf the site theme directory.
        return false;
    }
    // Make the new site theme active.
    $current_template = __get_option('template');
    if ($current_template == WP_DEFAULT_THEME) {
        update_option('template', $template);
        update_option('stylesheet', $template);
    }
    return $template;
}