make_site_theme() WordPress Function
The make_site_theme() function is used to create a new theme for a WordPress site. This function takes two parameters: the name of the theme and the path to the theme's directory. The name parameter is used to set the name of the theme. This can be any string. The path parameter is used to set the path to the theme's directory. This should be a valid path on the server. Once the function is called, a new theme will be created with the specified name and path.
make_site_theme() #
Creates a site theme.
Description
Return
(string|false)
Source
File: wp-admin/includes/upgrade.php
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |