WordPress Theme Development
WordPress Theme Development

WordPress is open source and it is used to manage content. It even gives you free plugins for most of the features, you don’t even need to think about how to design your pages, WordPress gives you beautiful themes which can be installed and used for free. That’s why it is said that WordPress is free and priceless at the same time.
But what if we want to build our own WordPress theme? I’m not talking about a child theme, or modifying or adapting to an existing theme. I’m talking about a theme built from scratch.

Building a theme from scratch can be a pretty daunting task. It was for me as I have never worked with WordPress before. Building from scratch is a whole new world. But there are advantages of creating your own theme, such as:
• Instead of creating a website that is just a clone of an existing theme, you can create your own unique theme and make it look exactly like you want it.
• You get to learn how things work, such as how post title or featured image is displayed in WordPress.
• You can give your own CSS and HTML tags.
• You can create only features which your project needs.
• You don’t have to rely on plugins, and spend time in wondering why it’s not working with your inbuilt theme, mostly you don’t even need a plugin, you just need to find the right command or function to perform your task.
• Any modification or addition will be easier and faster as you will already know which CSS Style or function to modify.

In order to start building a WordPress theme from scratch, we need to understand the structure of a WordPress theme and have some basic knowledge about HTML, CSS, JavaScript and PHP.
To create and activate your theme, some basic steps are:
• Download WordPress to your local machine and unzip the files.
• All the work related to WordPress theme is done in wp_content directory only. Just make a new subfolder in the wp_content → Themes folder.
• To activate WordPress theme, the first file a theme has to have is a style.css. To let WordPress know what our theme name is, mention the name of the theme at the top of the file. Many more optional comments such as description, author name can be added.
• We need to add function.php and index.php files before we can actually activate our theme.
• After all the necessary files have been added, you can activate your theme.

You can create many more files such as header.php, footer.php, home.php, single.php, comments.php etc based on how you want your theme layout. Header.php is used to show header section, single.php is used when you want to show single post information. To know which template to use for which section, you need to know the template file hierarchy. Template is selected based on the order specified in the hierarchy, if WordPress cannot find the file with the matching name; it will skip to the next file in the hierarchy. If any template file is not found, index.php will be used.

You can add header or footer section to any file simply by calling them using the template tags such as get_header(), get_footer(), get_sidebar(), etc. Based on the layout of your website, specific data such as title, description or featured image of the post or custom post type can be displayed anywhere you want it.

There are many files in a WordPress theme, understanding those files is the key to understanding WordPress theme development. Once you understand the platform, everything starts to fall in place, it will be less of hacking the theme and more of crafting and learning.


Yogeeta Shirodker

Post Comments

* marked fields are mandatory.