WordPress: how to create a theme. A quick introduction

how-to-create-wordpress-theme

With this article I want to give you a very comprehensive tour of how to create a new theme for WordPress. The starting assumption is that you are already quite familiar with WordPress and PHP.

I will use a small example that will show you the basics to create a WordPress theme, so then you can continue on the topic on your own.

The example

For claritiy, my environment is Xampp v.3.2.4. https://www.apachefriends.org/it/index.html

So the detection of a theme in WordPress Administrator console is actually all about the correct naming and position of the php files.

To have already a structure I recommend copying a pre-existing theme folder. In my example, I am copying the “twentynineteen” theme folder and pasting as “NewTheme”

In the new folder created you will find tons of files. But the ones that you need to start for creating a theme are the ones below (so you can get rid of all the other ones).

Now you have all the basic files to start working on the new theme.

The new theme will be now recognized in the Themes tab of the Administrator Panel of WordPress, but it will have the name and the icon of the copied theme.

To change the name of the WordPress theme that has been created you need to open the style.css file, delete all the content, and then paste the code below.

/*
Theme Name: The name of your theme
Author: The Author's Name
Description: ...
*/

Then fill the Theme Name, Author and Description as you wish.

To change the icon of the theme you will just need to replace the “screenshot.png” file with the one you desire.

Next steps?

The creation of a theme continues of course with the modifications on the root files, that I listed before.

I will guide through the functionality of each of theme in another article.

Be the first to comment

Leave a Reply

Your email address will not be published.


*