Develop WordPress Theme - Part 1 - Basic Steps to Start.
In these Article, I'll try to teach you 'How to Create, Build, Develop you own First WordPress Template. I can Just only show 'What to do' and 'How it works' but Building a good theme is little daunting task and needs a Proper knowledge in these areas.
- Basics on 'How things Work in web designing'.
When, I entered in this area of development, It took me just one hour to understand it's mechanism because I done my work mostly from scratch. So, Overall my suggestion is that you should first focus on creating 'HTML Templates (for dynamic sites) using PHP' before wasting your precious time in this area because you can easily convert them into WordPress templates with simple and easy to follow steps (by Just inserting few lines of php code).
So, I'll not waste your precious time and here are those steps you need to follow (For Those, who just entered in this area of development).
- Go to the directory in which your WordPress files are located.
- Open the folder named as 'WP-content'.
- Open the folder named as 'Themes' and create a new folder with your theme name inside it for example 'myNewTheme'.
- Then, Create two new files in that folder with these name and extension i.e. style.css and index.php.
- Then, open the style.css file in editor and paste this code at the top of it.
/* CSS Document */ /* Theme Name: My own Theme Theme URI: http: //example.com/ Description: This is my first theme. Author: Shrikrishna Meena Author URI: http: //example.com/ Template: twentyten Version: 1.0 */ @import url("../twentyten/style.css");
- Do changes in the above code as per the requirements but do not edit the line starting with 'Template: twentyten' and '@import'.
- And, that's all, Your theme will now appear in theme section of your WordPress admin area. You can click on Activate button to see it in action.
- Now, you can type your 'WordPress blog address' in web browser to see whether it works or not. If a blank page appears/opens, Then it is working and ready for further development (I Mean editing).
- To view snapshot with template details in theme section of your WordPress admin area, copy and paste a good image in your theme folder and change it's name to 'screenshot.jpg'.
So, That was the short and clear tutorial to introduce, 'How do the themes work in WordPress'.
Note : Don't compare this as WordPress hack, Instead, things work only like this in WordPress.
Actually, The work we've done in upper part is to create a child theme of original WordPress theme i.e. of Twenty Ten (Default WordPress theme). What I want to say with previous statement is that Until our theme is fully developed, on missing sections, twentyten theme will serve the content to visitors without compromising anything. A fully developed theme requires many pages including php scripts, Proper HTML coding etc. So, here are required pages that every theme should have to handle requests sent by browsers (So, link of twentyten will vanish from our theme completely).
Forget everything, if you're having difficulty in understanding above paragraph and Here are the pages that our theme should have a minimum,
- style.css (Highest Priority),
- index.php (Highest Priority),
- 404.php (Shows 'Page Not Found' Error to visitor),
- Page.php (For serving pages like 'About Me', 'Contact Me' etc. that you create in your WordPress blog),
- single.php (For pages showing 'blog posts'),
- search.php (For showing Search results).
For more details and queries, you can visit WordPress official help section here, but before that, you can bookmark this article on either bookmarking site like' delicious' or in 'Web-browser' to read my future articles on this topic.
Next Chapter/Tutorial : Designing Proper Template.
You can read my another article "How to Install WordPress on your own computer", if need any help on installing WordPress on localhost.