WPLift is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.
How to Make a WordPress Theme – Three Methods to Use in 2023
Are you planning to create your own theme? In this post, we share exactly how to make a WordPress theme.
WordPress is a popular open-source content management system (CMS) that is used all over the world. With the aid of the powerful WordPress website builder software, you can also use this platform to easily construct a strong online presence and develop your business online. WordPress is a no-brainer and the easiest to get started with. And it is for this reason that every developer advises you to use it as the foundation of your website.
The only way to truly grasp how WordPress Themes operate is to get in head first and do everything yourself. Yes, it’s tempting to avoid this because WordPress can handle everything for you if you don’t know how to code. By the end of this tutorial, you’ll learn how to make a WordPress theme, have a better grasp of how everything fits together, and how to use WordPress at your leisure.
What is a WordPress theme, exactly?
A WordPress theme is a collection of files (graphics, style sheets, and code) that determines how your blog or website looks. Themes may govern anything from your site’s style to the colors of its hyperlinks. It’s easy to think of a theme as a “skin” for your website, but they’re so much more.
A theme allows you to manage the appearance of your blog rather than just giving it a look and feel.
WordPress comes with its own set of themes. In reality, the platform comes with a variety of pre-installed themes. There are a few reasons, though, why you might wish to select and install a new theme on your website:
To enhance the aesthetic attractiveness of your website. You can select an appropriate theme and adjust it to fulfill your requirements if you have a special vision for your site.
To provide for additional design flexibility. Many themes provide a plethora of adjustments to assist you to build the perfect design if you have no design or coding knowledge. A theme may feature features pertaining to your niche that you won’t find anywhere else, depending on your demands.
While the basic or modified version of a theme can serve for a wide range of websites, there are hundreds of themes to pick from, each addressing a unique niche or purpose.
So, why create your own WordPress theme?
The choice of a theme is one of the most significant aspects of creating or maintaining a WordPress site. Usually, you have a number of alternatives to pick from. You may pick a certain theme foundation and then a theme built on top of that framework, depending on your needs.
Article Continues Below
Most consumers go through hundreds of themes, both free and paid, before selecting one that appeals to them and closely reflects what they desire. Most of them come with modification options to change them to some level out of the box, but the general appearance and feel remain the same.
The best choice, though, is to start from scratch and design a bespoke theme. Obviously, this necessitates some technical knowledge as well as the ability to design a website. Once you’ve found a design that works for you, a custom theme is the best way to put it into action.
In comparison to utilizing a third-party theme or a child theme, creating a custom theme offers a number of advantages.
- Individuality: You have created a theme that is unique to your website. It implies that your website is the only one that uses it, and it differs from the tens of thousands of others that use the same theme but with a different color scheme.
- Improved Safety: The custom theme is less likely to have serious security problems because you’re using fewer features and less code. Even if it’s probably difficult to be certain about bugs, you’re not waiting on a third-party vendor to release a security or bug fix. You can take care of them when you come across them.
- There isn’t any feature overload: Custom themes do not require a slew of functionality that you will never use or require. All of these undesirable features add a significant amount of executable code to your website, potentially slowing it down.
- Use of Plugins Should Be Limited: This is especially true of the plugins you employ to alter and arrange your material. This can reduce the theme’s dependency on third-party plugins while simultaneously speeding it up by eliminating the need to inject plugin code at runtime. However, depending on the functionality that it provides, not all plugins can be incorporated.
- Search Engine Optimization (SEO): is a term that refers to the process of optimizing a website. A custom theme is generally very light on source code, with nearly no new code. The lean code, which makes the websites incredibly light, is the major SEO benefit here. There are various frameworks and themes dedicated to speed that are always an option, but a custom theme is always the best solution.
Choosing a Theme-Building Approach
There is more than one way to build a custom WordPress theme, so the method you choose should be suitable for your coding experience.
Building an entire theme manually is undoubtedly the best approach, but you’ll need expressive coding skills and familiarity with the Apache web server environment if you choose to go down this path.
Fortunately, you don’t have to be a programming expert to create a new WordPress theme. So, if creating stylesheets and index.php files isn’t your thing you should consider the alternatives.
Theme builders are usually bundled with popular page builders like SeedProd, Divi, or Elementor. However, you’ll need a pro version of these plugins to access the theme builder feature.
In this article, I’ll show you how to build a theme manually and with SeedProd or web design software like TemplateToaster.
What are the prerequisites for developing a WordPress theme?
You need a website to get started. Any site will suffice. You don’t need to know any PHP or have any prior WordPress knowledge. But a development environment with Apache, PHP, MySQL, and WordPress installed is required to design a WordPress theme. You can get WordPress from the official website, but you’ll need to change the database credentials first.
You must also understand the theme’s structure. In its simplest form, a WordPress theme is a regular HTML page that is made up of the following files:
- header.php – a file that stores the header code.
- footer.php – holds the code for the footer;
- sidebar.php – where you set up the buttons on the side of the page;
- style.css – manages the theme’s aesthetic appearance;
- index.php – The settings provided on the main page are included here.
- single.php – includes code for displaying the article on its own page;
- page.php – includes code for displaying a single page’s content;
- archive.php – displays a list of items in the archive, as well as the categories that the user has defined;
- functions.php – This file contains functions that enhance theme functionality, such as logos, menus, color, thumbnails, scripts, and stylesheets.
- 404.php – an error code indicating that the requested file could not be found.
In order to personalize your template, you’ll also need to incorporate certain Bootstrap settings. We’ll walk you through the first steps of this customization in this post. See the list below.
Step 1: Make a folder to hold the files you’ll be adding
We need to know where the files that make up a WordPress theme sit in a WordPress installation if we’re going to construct themes. This is a simple task. We know that a WordPress installation usually contains a WordPress directory as its root directory. Here is how our root directory appears.
Themes is a folder within the wp-content folder. The location of your new theme in the “themes” folder, will be feasible to activate and use online. It’s also the folder in which you’ll find one or more themes to utilize with your WordPress website.
Step 2: Create the index.php and style.css files
You must additionally create two necessary files index.php and style.css when you finish constructing your theme folder.
Only the Theme Name is required in style.css so that WordPress can locate and list your theme so that you may activate it.
- Theme Name: customtheme
- Author: WPlift
- Author URI: https://wplift.com
- Version: 1.0
We just assign a Theme Name, Author, Author URI, and Version number to our theme in the example. But if you want a more decent theme you can include this info below:
Theme Name – A theme name should always be provided. If you don’t, the folder name will be used, which in this case is my-custom-theme.
Theme URI – it should direct users to a website where they may learn more about the theme.
Author – This is where you put your name.
Author URI – Here you may add a link to your personal or business website.
Description – is displayed in both the wp-admin theme modal and the WordPress theme listing.
Version – Version numbers help developers keep track of changes and ensure that customers are using the most up-to-date version. To indicate the severity of changes in an update, we use the SemVer numbering system.
License – You may choose how your theme is licensed, but if it isn’t GPL-compatible, you won’t be able to distribute it on WordPress.
License URI – just a link.
Text Domain – The text-domain is utilized when translating your theme into other languages. Don’t worry, we’ll get into more information about this later. For now, knowing that the theme folder and text-domain should be the theme name separated by hyphens rather than spaces is sufficient.
Tags – Only when uploading a theme to the WordPress.org theme directory are these variables utilized. The ‘‘Feature Filter‘ process is built around them.
Although none of the fields are technically essential, they are strongly recommended if you want your theme to appear decent in wp-admin. They’re also essential if you’re going to use WordPress to distribute your theme.
WP loads the posts that will be shown on the screen using this file. In addition, if a WP base file is missing, wp will use it.
- <h1>Custom Theme!</h1>
Step 3: In the WordPress dashboard, activate the theme
Go to the WordPress Dashboard, choose “Appearance,” then “Themes,” and see if the newly built theme is shown among the possibilities.
To check if the information entered in the style is correct, go to “Theme Details.”
The CSS file is right.
On WordPress, go to the Themes page and manage your themes.
Click “ Activate” to activate your new them in WP, then see if the website whether the changes have been applied.
Step 4: Change the settings in the index.php file
To test if your theme works, return to the index.php command line and erase the content you just typed.
After, create a command line for WP in order to retrieve from the database the posts and show them on the page. You must restore the post’s title and content so that all of the files can be seen on the home page.
The “have posts” command instructs WP to look for blog posts in the database. The page will be updated if there are any new listings. If not, the message for the negative response condition that we set in the code will be shown (false).
There is a function named “the post” that must be added to the while doing loop “have posts” in order for WP to show that file whenever the “have posts” condition is true. WordPress looks for new entries in this loop and shows them on the page as needed.
In reality, if the database includes posts, all actions within the loop will be executed for all post files identified while they are being discovered. Otherwise, WP will inform the user that there are no posts accessible. Look at the code below:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h2><a href=”<?php the_permalink() ?>”><?php the_title() ?></a></h2> <?php the_content() ?> <?php endwhile; else : echo ‘<p>There are no posts!</p>’; endif; ?>
In this loop, two functions, “have posts” and “the post,” are utilized in their most basic form. If any postings in the database need to be repeated, use the “have posts” method. True or false will be returned by this function, with true signifying that there are posts to display. There are none if it returns false.
The “the post” method fetches the most recent post and makes the required adjustments to show it chronologically on the theme page. Because this is a loop, if the function returns true, every time a new post is made, it will be instantly appended.
The content is attached to the file title put on the page using the “the content” function. The “the permalink” function creates a link to each individual post, allowing users to view the information without having to scroll through the entire text on the main page.
Simply use the “the excerpt” method instead of the “the content” method to add a quick summary under the file title with the first 200 characters of the content. As a result, when the user clicks on the link, they only get the whole text.
In this instance, you’ll need to create a new file in your theme’s folder that looks similar to “index.php” (simply copy and paste the index.php loop and replace the “the excerpt” function with “the content”).
Step 5: Add header and footer
Create new files in the same folder as your theme like the following step, where style.css and index.php are already present. Header.php and footer.php are their names.
It’s best to include wp head in all of your themes since it’s a specific function that wraps up the output in the header.php file’s head> section. It should be placed before the closing /head> tag to make it easier to add plugins to the site, since this hook may be used to add styles, scripts, or meta components to the head> region.
The footer.php file can close the tags used in the functions, as described below:
Step 6: Create the functions.php folder
At this stage, the custom theme has four file folders: index.php, style.css, header.php, and footer.php. The next file you should write is functions.php, which gives WordPress personality by allowing the command-line to change the CMS’s default behavior. The following are its characteristics:
- does not require a unique header text; only works when the theme is active;
- applies only to the current theme;
This code will include or activate the stylesheet for your custom theme:
How to Build a Theme with SeedProd?
You must subscribe to SeedProd’s Pro or Elite package to unlock the plugin’s theme builder feature. Its Basic and Plus plans come with a powerful page builder, but they don’t allow users to create custom themes.
Once you activate and verify the plugin, you can navigate to the SeedProd menu on the WordPress dashboard and access its theme builder.
You can create each theme element on your own or use a template and simply remove the elements you don’t want to include in a custom theme you’re building.
So, here’s how to create a new theme with a template:
- Click on the Theme icon in the plugin’s Theme Builder and choose the one you’d like to customize.
- SeedProd will generate theme elements automatically. Proceed to toggle off each element you don’t want to use by clicking the button next to it. The plugin also lets you determine the conditions under which a certain element appears on a page.
- Clicking the Edit Design button next to an element will enable you to change its color scheme, select a new font, or upload logos and other images you’d like to add to an element.
- After you customize the homepage, header and footer, and blog pages you can connect a mailing service to a theme.
Click the Enable SeedProd button when ready to publish the theme and access it from the Appearance menu on the WordPress dashboard
Using TemplateToaster to Create a Custom WordPress Theme
The software isn’t compatible with macOS and you’ll need a virtual machine to use on a Mac. That’s why I think making a custom theme with TemplateToaster is only a good idea if you have a PC.
The first thing you’ll need to do when you launch the software is select the WordPress platform since TemplateToaster also lets you build themes for WooCommerce, Joomla, Drupal, and other platforms.
The software has a wide selection of theme templates, but it also allows you to build a theme from scratch.
So, if you decide to create a theme on your own, you’ll have to define its color scheme and typography.
Afterward, you’ll have to design the header, menus, and footer and customize the homepage’s content segment. The software lets you create as many pages as you want and makes adding them to different menus easy.
You can export the theme you created to a local hard drive and import it to WordPress by clicking on the Add New button in the Theme’s window.
Frequently Asked Questions About Making WordPress Themes
How Can I Create My Own Theme in WordPress?
You can either make a new WordPress theme manually or automatically. The creation process will depend on the approach you choose. Building a new theme manually requires some coding knowledge and setting up an offline environment that allows you to create different files.
Elementor, Divi, and other page builders eliminate the need to create files a new theme must contain. Instead, you can focus on selecting the elements you want the theme to have and customizing their appearance. Also, software products like TemplateToaster or Artisteer let you design custom themes you can import to WordPress.
Is it Difficult to Create a WordPress Theme?
Making a new WordPress theme can seem scary if you don’t have the basic understanding of theme structure or feel confident writing code.
The task gets easier with practice, so you should give yourself time before attempting to create a WordPress theme manually. Also, you must test if all theme’s functionalities are working properly and fix all bugs before going live. Building a theme with SeedProd, Elementor or Divi is much easier because you can customize all elements without altering their code.
How Do I Create a Custom WordPress Theme Template?
Installing a theme builder plugin is the easiest and fastest way to start working on a new WordPress theme.
In most cases, you can choose if you want to modify an existing template or create a theme from scratch. These plugins allow you to select the elements you want the theme to have and define their visual identity.
In addition, you can build a global header, global footer or custom 404 pages. Once you design each element, you can publish a theme and install it on your website.
Wrapping It Up
It’s finished! Your theme was constructed and the links that send the visitor to an exclusive page for each article operate well. In addition, you’ve already included your custom theme’s header, footer, and CSS.
You learned the fundamentals of creating a WordPress theme in this lesson. Because website appearance is vital, especially for business applications, you may use Bootstrap to add lines of ready-made template scripts to your page, making it easier to add new features and functionality. Let us know how you get on with this one!
16 thoughts on “How to Make a WordPress Theme – Three Methods to Use in 2023”
LOL – what a terrible comment Xanfer! So terrible all I could do was laugh. Oli has been kind enough to lay out what is a very efficient and straightforward process for building themes that believe you me can easily become a real mess to those with less experience. Oli I think anyone building WordPress themes will get a lot of value out of this post.
Thanks for sharing.Ed
Thanks Ed – nice of you to say :)
I would like to know more about psd to wp conversion
He he there is no easy way out for that man. All you need is to slice it and code it from scratch… well you can still use this guide for coding.. do you think there is an easy way to do that… something like a plugin? Oh boy…!!! the answer is no..!!
I am a theme developer, I have 5 themes in market.I am not a beginner :)
All I said was I would like to know more about psd to wp conversion.
LayoutLab is a good find!
Thanks for sharing your workflow.
I sure will use some of these tips for my own themes.
Can you post the ”
Defaults – These are the default styles that WordPress needs “, I haven’t found a really good one. Only this one
Thats all you need – all the styles are listed there,
Add those to your CSS file and write some styles for them.
A good starting point is taking them from the default twenty eleven theme.
Excellent tutorial, I read quite a lot of blogs and it isn’t
often that you actually find a useful tutorial that actually give real
information, most bloggers don’t want to give away secrets so they’ll always
beat around the bush. Good work.
Hi Sir, do you have any plans to share the blank theme you use? Thanks in advance for your reply.
veri god job i love the article…
Thank you for this useful tutorial to make a word press theme !
thank you! helpful
Is it just me or this blog is lacking a timestamp ? Very important thing IMO
Comments are closed.