Using WordPress ‘make_site_theme_from_default()’ PHP function

The make_site_theme_from_default() WordPress PHP function creates a site theme from the default theme.

Usage

make_site_theme_from_default($theme_name, $template);

Input:

  • $theme_name: “My Custom Theme”
  • $template: “my-custom-theme”

Output:
A new site theme with the name “My Custom Theme” and directory “my-custom-theme”.

Parameters

  • $theme_name (string) – The name of the theme.
  • $template (string) – The directory name of the theme.

More information

See WordPress Developer Resources: make_site_theme_from_default()

Examples

Creating a Simple Site Theme

This example creates a site theme called “Simple Site Theme” with the directory name “simple-site-theme”.

make_site_theme_from_default('Simple Site Theme', 'simple-site-theme');

Creating a Photography Site Theme

This example creates a site theme called “Photography Portfolio” with the directory name “photography-portfolio”.

make_site_theme_from_default('Photography Portfolio', 'photography-portfolio');

Creating an E-commerce Site Theme

This example creates a site theme called “E-commerce Store” with the directory name “ecommerce-store”.

make_site_theme_from_default('E-commerce Store', 'ecommerce-store');

Creating a Blog Site Theme

This example creates a site theme called “Personal Blog” with the directory name “personal-blog”.

make_site_theme_from_default('Personal Blog', 'personal-blog');

Creating a News Site Theme

This example creates a site theme called “Daily News” with the directory name “daily-news”.

make_site_theme_from_default('Daily News', 'daily-news');

Tagged in

Leave a Comment

Your email address will not be published. Required fields are marked *