A beginner’s guide to develop your WordPress theme

Creating and growing a theme in WordPress might be quite simple in case you have some data of HTML, CSS, and JavaScript. Despite this, some freshmen may full this mission with the appropriate directions. You simply want to have a correctly configured improvement surroundings and the CMS (Content Management System) put in.

WordPress is likely one of the most generally used open-source content material administration methods on the planet — round 34.7% of all web sites run on it. It has site-building instruments and permits you to add numerous options by means of plugins and different assets that customise the format, improve efficiency, and assure a professional expertise for your viewers.

In this text, we present you the primary steps to create a WordPress theme to be able to have a web site with a novel look. Check it out:

Shall we proceed?

What are the necessities to create a WordPress theme?

To create a WordPress theme, you need to have a improvement surroundings configured with Apache, PHP, MySQL, and WordPress put in. You can obtain WordPress from the official web site — you need to replace the database credentials.

You additionally want to know the construction of the theme. Basically, a WordPress theme is a traditional web page, created in HTML and, like every other, is fashioned by the next information:

In addition, you’ll need to combine some Bootstrap settings to customise your template. In this text, we are going to train you the primary steps to this customization. See beneath.

Create a successful blog with Stage!

What are the primary steps to create a WordPress theme?

Below are the steps for you to create a WordPress theme till it may be personalized.

Create a folder to retailer the information you’ll add

If we’re going to construct a brand new theme, we want to know the place its information can be in your native set up. This is fairly straightforward.

We know that a WordPress set up often has a root listing, additionally known as wordpress. In this listing are the information and folders that we are going to present beneath.



The folder we’re searching for is wp-content, the place themes and plugins are saved. Inside, there’s a folder known as themes, which should comprise all your WordPress web site’s themes, together with the one you’ll create in order that the CMS acknowledges the brand new settings.

develop theme on wordpress

In the themes folder, three different native folders are already saved, which comprise three customary themes, supplied by WordPress. In addition to them, you need to create one other folder, which you’ll title as you would like.

In the instance beneath, the folder is called customtheme. From that time, the brand new WordPress theme can be created.

customtheme wordpress

It is important that your new theme is contained in the “themes” folder. That method, it’s attainable to activate it and use it on-line.

Create the type.css and index.php information

Every WordPress theme has a collection of necessary information to work correctly. In your new folder inside Themes, create two information:

customtheme wordpress


Style.css is a declarative and vital CSS file for all WordPress themes. It controls the presentation — visible design and format — of the web site pages. That is, on this file, you’ll specify details about the theme: the theme’s title, writer, writer web page, and model quantity (on this case, since we aren’t updating a theme and, as an alternative, creating one from scratch, you may assign it model 1), for instance.

This info wants to be written in a standardized method in order that WP can determine it, as specified beneath:

/ *

Theme title: title of the theme (this title will present up on the listing);

Theme URI: the web site that may be created to exhibit the functionalities of the theme, it may well additionally comprise a type for individuals to give you the chance to purchase it;

Author: write your title, so individuals can contact you if they’re serious about your theme;

Author URI: in case you have your personal web site, you may add it on this line of code;

Github Theme URI: it’s fascinating to add the theme on Github in order that customers can add new options, counsel enhancements, and reply questions in that collaborative surroundings, for instance;

Description: add details about the theme, if it’s appropriate for a particular sort of enterprise, weblog, e-commerce, and so on.;

Version: 1.zero.zero.;

Text area: it’s necessary to translate the theme into different languages.

* /

theme name


This file is answerable for itemizing the entire weblog’s posts. You want to use native WP features to present them on the display. Developers are used to connecting databases and making queries to get the content material and show it however, on this case, there are already native features in WordPress.

Create the index.php file and sort something on the command line, simply to see if it is going to seem in your theme whenever you activate it.

<h1>Hello world!</h1>


<h1>Custom Theme!</h1> like in our instance beneath:

wordpress theme tutorial

Activate the theme within the WordPress dashboard

Access the WordPress Dashboard, click on on “Appearance”, then on “Themes”, and test if the created theme is among the many displayed choices.

themes page on wordpress

Click on “Theme Details” to test if the data entered within the type.css file works appropriately.

manage themes page on wordpress

Click on “Activate” to have the brand new theme activated by WP after which go to the web site to test if the settings have been carried out.

Change the index.php file settings

Go again to the index.php command line and delete the textual content you simply wrote to test if your theme works. Now, you need to write a command line for WP to fetch the posts from the database and ship them to the web page.

The objective is to get well the title of the put up and its content material so that every one information might be seen on the house web page.

The “have_posts” command tells WP that it should search the database for weblog posts. If there are posts, it will likely be displayed on the web page. If not, it is going to present the message we wrote within the code for the destructive response situation (false).

posts on wordpress

There is a perform known as “the_post” that have to be added to the whiledo loop “have_posts” in order that WP shows that file every time it identifies it as true for the “have_posts” situation. Through this loop, WordPress checks for posts and shows them on the web page as wanted.

In follow, it really works as follows: if there are posts within the database, all instructions contained in the loop can be executed for all put up information discovered, and whereas they’re discovered. Otherwise, the WP informs the consumer that there are not any posts. See the code beneath:


 if ( have_posts() ) :

whereas ( 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>’;



Note that two features are used of their most elementary type on this loop: “have_posts” and “the_post”. The “have_posts” perform informs you if there are any postings within the database to repeat. This perform will return true or false: if it returns true, there are posts obtainable to show. If it returns false, there are none.

The “the_post” perform retrieves the newest put up and performs the required configurations in order that it’s displayed chronologically on the theme web page. As this occurs in a loop, every time there’s a new put up, it will likely be added robotically if the perform returns true.

The “the_content” perform attaches the content material to the file title inserted on the web page. The “the_permalink” perform matches a hyperlink to every particular person put up in order that the consumer can entry the content material on their very own and with out the complete textual content being displayed on the house web page.

If you need to add a quick abstract below the file title, with the primary 200 characters of the content material, simply insert the “the_excerpt” perform rather than the “the_content” perform. Thus, the consumer solely has entry to the complete textual content when clicking on the hyperlink.

In this case, you should have to create a brand new file in your theme’s folder, comparable to “index.php” (even with the identical line of code, simply copy and paste the index.php loop and alter the “the_excerpt” perform to “the_content”).

Add header and footer

The subsequent step is to create new information in the identical folder as your theme, the place you added the information type.css and index.php. They are known as header.php and footer.php.

add header and footer wordpress theme

It’s good follow to all the time embody wp_head in your themes, as it is a particular perform that finalizes the output within the <head> part of your header.php file. It ought to be used earlier than the closing </head> tag, primarily to facilitate the addition of plugins to the positioning, which might depend on this hook to add types, scripts, or meta parts to the <head> space.


The footer.php file can shut the tags used within the features, as described beneath:

footer wordpress theme

Create the features.php folder

At this level, 4 file folders have been added to the customized theme: index.php, type.css, header.php, and footer.php. The subsequent file it’s best to create is known as features.php, which provides persona to WordPress since its command-line can modify the default habits of the CMS. It has the next traits:

This code will embody or activate the stylesheet for your customized theme:

stylesheet wordpress theme

Which instruments may help to create a WordPress theme?

All carried out! Your theme was created and works appropriately with the hyperlinks that direct the consumer to an unique web page for every put up. In addition, you could have already added the header, footer, and stylesheet for your customized theme.

However, you need to nonetheless add different necessities to your web page in order that the template has distinctive traits. Many individuals imagine that the theme’s performance is solely aesthetic but it surely additionally has a big impact on a web site’s efficiency.

To carry out these customizations, it’s vital to use hooks — items of code inserted in template information, resembling index.php or features.php —, which permit you to execute PHP actions in several areas of a web site, add types, and show different info.

Most hooks are carried out immediately within the WordPress core however some are additionally helpful for theme builders. The hook “after_setup_theme”, for instance, prompts the highlighted photographs (thumbnails) for every put up, provides a brand for the web site, and menus in header.php and footer.php. There are additionally different hooks, as described beneath:

In this tutorial, you realized the fundamentals of how to create a WordPress theme. As the web site design can be necessary, particularly for company purposes, you may add traces of ready-made template codes in Bootstrap, which might facilitate the method of including new options and performance to your web page.

And now that you know the way to develop your personal WordPress theme, what about getting some data on how to create a company weblog for your enterprise? Download our free book!

WordPress Guide for Corporate Blogs - Promotional Banner

Source hyperlink Video Marketing

Be the first to comment on "A beginner’s guide to develop your WordPress theme"

Leave a comment

Your email address will not be published.