Summery Summery
Creates a site theme from an existing theme.
Syntax Syntax
Description Description
Parameters Parameters
- $theme_name
-
(Required) The name of the theme.
- $template
-
(Required) The directory name of the theme.
Return Return
(bool)
Source Source
File: wp-admin/includes/upgrade.php
return $for_update; } /** * Updates the database tables to a new schema. * * By default, updates all the tables to use the latest defined schema, but can also * be used to update a specific set of tables in wp_get_db_schema(). * * @since 1.5.0 * * @uses dbDelta * * @param string $tables Optional. Which set of tables to update. Default is 'all'. */ function make_db_current( $tables = 'all' ) { $alterations = dbDelta( $tables ); echo "<ol>\n"; foreach ( $alterations as $alteration ) { echo "<li>$alteration</li>\n"; } echo "</ol>\n"; } /** * Updates the database tables to a new schema, but without displaying results. * * By default, updates all the tables to use the latest defined schema, but can * also be used to update a specific set of tables in wp_get_db_schema(). * * @since 1.5.0 * * @see make_db_current() * * @param string $tables Optional. Which set of tables to update. Default is 'all'. */ function make_db_current_silent( $tables = 'all' ) { dbDelta( $tables ); } /** * Creates a site theme from an existing theme. * * {@internal Missing Long Description}} * * @since 1.5.0 * * @param string $theme_name The name of the theme. * @param string $template The directory name of the theme. * @return bool */ function make_site_theme_from_oldschool( $theme_name, $template ) { $home_path = get_home_path(); $site_dir = WP_CONTENT_DIR . "/themes/$template"; if ( ! file_exists( "$home_path/index.php" ) ) { return false; } /* * Copy files from the old locations to the site theme. * TODO: This does not copy arbitrary include dependencies. Only the standard WP files are copied. */ $files = array( 'index.php' => 'index.php', 'wp-layout.css' => 'style.css', 'wp-comments.php' => 'comments.php', 'wp-comments-popup.php' => 'comments-popup.php', ); foreach ( $files as $oldfile => $newfile ) { if ( 'index.php' === $oldfile ) { $oldpath = $home_path; } else { $oldpath = ABSPATH; } // Check to make sure it's not a new index. if ( 'index.php' === $oldfile ) { $index = implode( '', file( "$oldpath/$oldfile" ) ); if ( strpos( $index, 'WP_USE_THEMES' ) !== false ) {
Advertisement
Changelog Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |