PurabTech is technical blog for Programmer and Coders
how to create wordpress theme from scratch
many people written about creating wordpress theme and using wordpress hooks. Here in this tutorial I will show How to create wordpress theme from scratch.
create wordpress theme from scratch
Here in this tutorial I will show How to create wordpress theme from scratch. I given very detailed steps to create wp theme. You can create wp theme from simple jpg file or PSD file. First choose or create your html template from photoshop. For creating the html template you can refer following screen shots for creating photoshop image. This is very common layout for creating any webpage.
create wordpress theme from scratch
Here for this tutorial I am using following image for creating the wordpress theme.
create wordpress theme from scratch
After creating image in photoshop you need to create the html according to this image. Here I created the one index.html file and style.css file.
You can download the HTML from here:
<h2><ahref="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</a></h2>
036
<p><span>September 10, 2009</span><span>Posted by <ahref="#">wordpressapi</a></span></p>
037
<divstyle="clear: both;"> </div>
038
<div>
039
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<h2><ahref="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</a></h2>
045
<p><span>September 10, 2009</span><span>Posted by <ahref="#">wordpressapi</a></span></p>
046
<divstyle="clear: both;"> </div>
047
<div>
048
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<h2><ahref="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</a></h2>
054
<p><span>September 10, 2009</span><span>Posted by <ahref="#">wordpressapi</a></span></p>
055
<divstyle="clear: both;"> </div>
056
<div>
057
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum..</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
069
</li>
070
<li>
071
<h2>Categories</h2>
072
<ul>
073
<li><ahref="#">wordpress </a></li>
074
<li><ahref="#">wordpress theme</a></li>
075
<li><ahref="#">wordpress plugins</a></li>
076
<li><ahref="#">wordpress tips</a></li>
077
<li><ahref="#">wordpress hacks</a></li>
078
<li><ahref="#">wordpressapi</a></li>
079
<li><ahref="#">wordpress tutorials</a></li>
080
</ul>
081
</li>
082
<li>
083
<h2>Blogroll</h2>
084
<ul>
085
<li><ahref="#">wordpress.com</a></li>
086
<li><ahref="#">wordpress.org</a></li>
087
<li><ahref="#">purabtech.in/files/</a></li>
088
<li><ahref="#">google.com</a></li>
089
<li><ahref="#">yahoo.com</a></li>
090
<li><ahref="#">live.com</a></li>
091
<li><ahref="#">facebook.com</a></li>
092
</ul>
093
</li>
094
<li>
095
<h2>Archives</h2>
096
<ul>
097
<li><ahref="#">march 2010</a></li>
098
<li><ahref="#">feb 2010</a></li>
099
<li><ahref="#">january 2009</a></li>
100
<li><ahref="#">december 2009</a></li>
101
<li><ahref="#">november 2009</a></li>
102
<li><ahref="#">september 2009</a></li>
103
<li><ahref="#">july 2009</a></li>
104
</ul>
105
</li>
106
</ul>
107
</div>
108
<!-- end #sidebar -->
109
<divstyle="clear: both;"> </div>
110
</div>
111
</div>
112
</div>
113
<!-- end #page -->
114
</div>
115
<divid="footer">
116
<p>Copyright (c) 2010 purabtech.in/files/. All rights reserved. Design and Developed by <ahref="http://www.wordpressapi.org/">wordpressapi themes</a>.</p>
117
</div>
118
<!-- end #footer -->
119
</body>
120
</html>
Now we are going start to create the wordpress theme from html file which we created earlier.
First create the header.php file and copy paste the following code in that file. I taken the top header HTML code from base.html file.
<p>Copyright (c) 2010 purabtech.in/files/. All rights reserved. Design andDeveloped by <a href="http://www.wordpressapi.org/">wordpressapi themes</a>.</p>
4
</div>
5
<!-- end#footer -->
6
<?php wp_footer(); ?>
7
</body>
8
</html>
Create the sidebar.php file and copy paste the following code in that file. I taken the only the sidebar HTML code from base.html file. I taken only sidebar div from html and li tags and other widgets will be provided by wordpress admin, so you dont worry about that part.
Create the comments.php file and copy paste the following code in that file. I did not taken HTML code or php from base.html file. This is common wordpress comments template. If you are designer then you dont need to worry about comments code. you just need to copy paste the following code into comments.php file
<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>"title="<?php _e('Log out of this account') ?>"><?php _e('Log out »'); ?></a></p>
<?php endif; // If registration required and not logged in ?>
75
76
<?php else: // Comments are closed ?>
77
<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
78
<?php endif; ?>
Create the functions.php file and copy paste the following code in that file. In this file we are just registering the sidebar widgets, using following function.
Here is my style.css file. You can create this file as per your theme. We are using the same css which we created for base.html, We just added some of extra code for wordpress theme and img alignment.
This is nice wordpress tutorial, made some things clear for me! I found some nice posts about programming in wordpress at http://www.wp-coder.com . Thanks!
What you posted here helped me quite a bit and im grateful for it!
This is nice wordpress tutorial, made some things clear for me! I found some nice posts about programming in wordpress at http://www.wp-coder.com . Thanks!
hi, i would like to make my own wordpress theme, can u pls help me with this, thanks