WordPress Themes

A theme controls the design and the layout of your site. When you change the theme, the content (posts, pages, media) stays the same, but the look of the site changes.

Classic themes and block themes

PointClassic themeBlock theme
TemplatesPHP files (header.php, single.php)HTML files with blocks in the templates folder
Design settingsCustomizer and PHP codeSite Editor and theme.json
Menus and widgetsAppearance > Menus and WidgetsNavigation block and template parts
ExampleTwenty Twenty-OneTwenty Twenty-Five

New themes are mostly block themes, but millions of sites use classic themes and they are fully supported.

Themes on a fresh WordPress

Terminal output

$ wp theme list –fields=name,status,version
name status version
twentytwentyfive active 1.5
twentytwentyfour inactive 1.6
twentytwentythree inactive 1.7
$ wp theme get twentytwentyfive –fields=name,title,version,status
Field Value
name Twenty Twenty-Five
title Twenty Twenty-Five
version 1.5
status active

Where to get themes

  • WordPress.org theme directory: free and checked themes, reachable from Appearance > Themes > Add Theme.
  • Premium theme shops and developers: paid themes with support. Download only from trusted sellers.
  • Custom themes: made by a developer for your site.
Note: Never install a “nulled” (cracked) premium theme. They very often have hidden malware.

Install, activate and delete a theme

  1. Go to Appearance > Themes > Add Theme, search a theme and click Install.
  2. Click Activate. The theme is now live (use Live Preview before, if you want).
  3. To remove a theme you do not use, open its details and click Delete.

The same with WP-CLI:

Terminal output

$ wp theme install twentytwentyone
Installing Twenty Twenty-One (2.9)
Downloading installation package from https://downloads.wordpress.org/theme/twentytwentyone.2.9.zip…
Using cached file '/tmp/wpcache/theme/twentytwentyone-2.9.zip'…
Unpacking the package…
Installing the theme…
Theme installed successfully.
Success: Installed 1 of 1 themes.
$ wp theme activate twentytwentyone
Success: Switched to 'Twenty Twenty-One' theme.
$ wp theme list –fields=name,status
name status
twentytwentyfive inactive
twentytwentyfour inactive
twentytwentyone active
twentytwentythree inactive
$ wp theme activate twentytwentyfive
Success: Switched to 'Twenty Twenty-Five' theme.
$ wp theme delete twentytwentyone
Deleted 'twentytwentyone' theme.
Success: Deleted 1 of 1 themes.

Where is a theme saved?

Every theme is a folder inside wp-content/themes. The folder has at least a style.css file (it holds the theme details in a comment) and a template file. Keep one default theme installed as a fallback, in case your active theme breaks.

Terminal output

$ ls wp-content/themes/twentytwentyfive
assets
contributing.txt
functions.php
package-lock.json
package.json
parts
patterns
readme.txt
screenshot.png
style.css
style.min.css
styles
templates
theme.json
$ ls wp-content/themes/twentytwentyfive/templates | head -8
404.html
archive.html
home.html
index.html
page-no-title.html
page.html
search.html
single.html

The development chapters of this website explain the files in depth: Theme Files and Functions.

Note: Choose a light and fast theme and do not worry about too many demo features. A heavy theme with many options slows down your site. Next: WordPress Top Theme List.

Congratulations! Chapter Finished. Learn more about the similar topics:
Exercises & Assignments
Build and activate a minimal classic theme
Show the three latest posts with WP_Query
Load a stylesheet with wp_enqueue_style and a version
Show a message only on the front page
Create a child theme which changes the footer
Interview Questions & Answers
What is a WordPress theme?
What are commonly used WordPress theme functions?
Which function is used to get the home URL in WordPress?
Which are the necessary files for a WordPress theme?
What is the use of the wp_head() function in WordPress?
What is the WordPress Loop?
What is the difference between is_home() and is_front_page()?