Himanshu SharmaSoftware engineer
Let’s talk

WordPress · Lesson 13 of 45

Choosing and installing themes

Understand what a WordPress theme does, block themes versus classic themes, how to choose a good theme, and how to install, switch and remove themes safely.

11 minSite setupUpdated 23 October 2026

By the end of this lessonPick a well-made theme, install and activate it, preview before switching, and know what changes and what stays when you change themes.

What a theme does

A theme decides how your site looks: page layouts, headers and footers, typography, colours, and the templates that turn posts, pages and archives into HTML. Your content lives in the database, separate from the theme, so you can switch themes without losing posts or pages.

WordPress ships with recent default themes, named after their release year. A fresh WordPress 7.1 site has three:

bash
wp theme list --fields=name,status,version
result
+-------------------+----------+---------+
| name              | status   | version |
+-------------------+----------+---------+
| twentytwentyfive  | active   | 1.5     |
| twentytwentyfour  | inactive | 1.6     |
| twentytwentythree | inactive | 1.7     |
+-------------------+----------+---------+

Block themes and classic themes

There are two kinds of theme:

  • Block themes (Twenty Twenty-Two onwards) build every part of the page, including header and footer, from blocks. You change them visually in Appearance → Editor (the Site Editor, next lesson). Their settings and styles live in a theme.json file.
  • Classic themes use PHP template files, and are customised with Appearance → Customize, widgets and menus. Many popular themes and older sites are classic.

You can tell them apart in code, too:

php
<?php
foreach ( wp_get_themes() as $slug => $theme ) {
	printf( "%-18s %-6s block theme: %s\n", $slug, $theme->get( 'Version' ), $theme->is_block_theme() ? 'yes' : 'no' );
}
result
twentytwentyfive   1.5    block theme: yes
twentytwentyfour   1.6    block theme: yes
twentytwentythree  1.7    block theme: yes

All three defaults are block themes. Block themes are the direction WordPress is moving in, and the developer part of this course builds one. Classic themes are still common, so the course also covers the template hierarchy they rely on.

Choosing a theme

Most sites use a theme from the official Theme Directory (Appearance → Themes → Add New Theme), a reputable commercial seller, or a theme built for them. Before choosing, check:

  • Maintenance: updated in the last few months, and tested with the current WordPress version.
  • Reviews and support: are support questions answered?
  • Accessibility: the Accessibility Ready tag means it passed extra checks for keyboard and screen reader use.
  • Speed: try the demo on a phone; heavy themes with sliders and animations everywhere are often slow.
  • Simplicity: a theme that does a lot through its own page builder or shortcodes can lock your content in; switching away later leaves a mess.

Avoid "nulled" (pirated) premium themes: they very often contain malware.

Installing and activating

In the dashboard, Appearance → Themes → Add New Theme lets you search the directory, preview and install. To install a theme from a zip file, use Upload Theme. With WP-CLI, wp theme install <slug> --activate does the same from the directory.

Switching themes is one click (Activate), but preview first with Live Preview, because the new theme may arrange menus, widgets and the front page differently. Switching between the bundled themes shows what changes:

bash
wp theme activate twentytwentyfour
wp option get template
wp option get stylesheet
result
Success: Switched to 'Twenty Twenty-Four' theme.
twentytwentyfour
twentytwentyfour

template and stylesheet record the active theme. They differ only when a child theme is active (a later lesson): template is the parent, stylesheet the child.

What changes when you switch

Content stays, but some things are tied to the theme:

  • Site Editor customisations of the old theme's templates and styles stay saved but no longer apply.
  • Classic menus and widgets are assigned to theme locations, so you may need to assign them again.
  • Theme-specific features, such as a portfolio post type or shortcodes provided by the theme, stop working. That is why such features belong in plugins.

Never edit someone else's theme

When a theme is updated, all its files are replaced. Edits you made directly to its files disappear. Instead:

  • use the Site Editor (block themes) or Customizer (classic themes) for design changes;
  • use a child theme for code changes to templates;
  • use a plugin for features.

Appearance → Theme File Editor lets administrators edit theme files in the browser. It is easy to break a site with a typo there, and many security guides recommend disabling it, as the hardening lesson shows.

Keep it tidy

Keep the active theme, plus one default theme as a fallback (if the active theme breaks, WordPress can switch to it). Delete other unused themes: even inactive themes can contain vulnerable code.

bash
wp theme delete twentytwentythree
wp theme list --fields=name,status
result
Deleted 'twentytwentythree' theme.
Success: Deleted 1 of 1 themes.
+------------------+----------+
| name             | status   |
+------------------+----------+
| twentytwentyfive | inactive |
| twentytwentyfour | active   |
+------------------+----------+

Common mistakes

  • Editing theme files directly and losing changes on the next update.
  • Choosing a theme for its demo photos rather than its quality.
  • Putting features in the theme, so they vanish when the theme changes.
  • Keeping many unused themes installed.

Exercise

Activate Twenty Twenty-Four on your local site, look at the home page, then switch back to Twenty Twenty-Five. Which two options in the database changed? Delete one unused theme.

Show one possible answer

template and stylesheet both change to twentytwentyfour and back to twentytwentyfive; check with wp option get template. The home page layout and fonts change, but posts and pages are the same. Delete Twenty Twenty-Three with wp theme delete twentytwentythree (or Appearance → Themes → Theme Details → Delete), keeping one spare default theme.

Key points

  • A theme controls presentation: templates, layout, typography and colours; your content stays when you switch.
  • Block themes are built from blocks and edited in the Site Editor; classic themes use PHP templates and the Customizer.
  • Choose maintained themes from trusted sources; check updates, ratings, accessibility and speed.
  • Never edit a theme you did not write; use a child theme or the Site Editor, or updates will erase your changes.

Check yourself

1. What happens to your posts when you switch themes?
2. How do you tell a block theme from a classic theme?
3. Why should you not edit a theme's files directly?
4. Which is a warning sign when choosing a theme?