If you can't install a theme from within wp-admin for whatever reason, you'll have to use the following procedure instead.
Additionally, due to the growing popularity of external theme sources, such as various theme stores and independent developers, downloading and installing a theme manually becomes the default way of handling things, and gradually replaces the traditional approach of getting a theme from the official directory.
Therefore, to provide a good example when explaining the manual installation, I'm going to get a theme (a free one) and guide you through the process of having it installed:
- To get started, what you need is to download your desired theme and save its ZIP archive somewhere on your desktop. Don't extract the archive. The theme I'd like to try out is called Underscores, and it's a free starter theme that's available at https://underscores.me/.
- Depending on the source of your theme, in order to actually get it, you might be required to either create a user account, make a purchase, or sign up for a newsletter, and so on. Of course, sometimes, there's just a direct download link. Underscores uses a pretty straightforward model. All you need to do is input the name that you want to use for your theme in the field at https://underscores.me/ (it can be whatever name you wish). Then, after clicking on GENERATE, you'll get a ZIP download:
- At this point, you can upload that ZIP file through wp-admin by navigating to Appearance | Themes and clicking on the Add New button. There, click on the Upload Theme button, which will take you to the place where you can finally perform the manual installation, as shown in the following screenshot:
- The only thing you need to do there is choose the ZIP file from your desktop and then click on the Install Now button. After a short while, you will be redirected to the success page, where you will be able to activate your new theme.
If this doesn't work, continue with the following steps to extract and upload the theme files manually.
- If you're on Mac, the ZIP file may have automatically been unzipped for you, in which case you'll see a directory on your desktop instead of the ZIP file, or in addition to the ZIP file. If not, then just do the extraction/unzipping manually so that you have the theme directory on your desktop.
- The following screenshot shows the file contents of the Underscores theme that I downloaded. Apart from the mandatory style.css file and the index.php file, it also has a number of other files that handle different tasks and take care of various aspects of the display and the functionality of the theme:
- You need to upload the theme directory to your WordPress website. As you did in Chapter 2, Getting Started with WordPress, you need to start an FTP connection with your server. Once there, navigate to your WordPress website's installation directory.
- Next, go to the wp-content directory and then to the themes directory. You'll see one theme directory in here already named twentynineteen (and possibly others as well). These are the themes that came pre-installed with WordPress. The only thing you have to do here is upload the directory that you've just unzipped a minute ago so that it sits alongside the default twentynineteen directory. And that's it!
At this point, when you go back to Appearance in your wp-admin, you will see the new theme waiting there. All that's left to do now is activate it and use it as the main design of your site.