make_site_theme

Advertisement

Summery Summery

Creates a site theme.

Syntax Syntax

make_site_theme()

Description Description

Return Return

(string|false)

Source Source

File: wp-admin/includes/upgrade.php

	// Rewrite the theme header.
	$stylelines = explode( "\n", implode( '', file( "$site_dir/style.css" ) ) );
	if ( $stylelines ) {
		$f = fopen( "$site_dir/style.css", 'w' );

		foreach ( $stylelines as $line ) {
			if ( strpos( $line, 'Theme Name:' ) !== false ) {
				$line = 'Theme Name: ' . $theme_name;
			} elseif ( strpos( $line, 'Theme URI:' ) !== false ) {
				$line = 'Theme URI: ' . __get_option( 'url' );
			} elseif ( strpos( $line, 'Description:' ) !== false ) {
				$line = 'Description: Your theme.';
			} elseif ( strpos( $line, 'Version:' ) !== false ) {
				$line = 'Version: 1';
			} elseif ( strpos( $line, 'Author:' ) !== false ) {
				$line = 'Author: You';
			}
			fwrite( $f, $line . "\n" );
		}
		fclose( $f );
	}

	// Copy the images.
	umask( 0 );
	if ( ! mkdir( "$site_dir/images", 0777 ) ) {
		return false;
	}

	$images_dir = @opendir( "$default_dir/images" );
	if ( $images_dir ) {
		while ( ( $image = readdir( $images_dir ) ) !== false ) {
			if ( is_dir( "$default_dir/images/$image" ) ) {
				continue;
			}
			if ( ! copy( "$default_dir/images/$image", "$site_dir/images/$image" ) ) {
				return;
			}
			chmod( "$site_dir/images/$image", 0777 );
		}

		closedir( $images_dir );

Advertisement

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Advertisement

Leave a Reply