<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>1stwebdesigner - Graphic and Web Design Blog &#187; Cosmin Negoita</title>
	<atom:link href="http://www.1stwebdesigner.com/author/cosminnegoita/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.1stwebdesigner.com</link>
	<description>1stwebdesigner is a design blog dedicated to bloggers, freelancers, web-developers and designers. Topics focus on web design and inspirational articles.</description>
	<lastBuildDate>Sun, 12 Feb 2012 13:09:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The Essential Guide to WordPress 3.0 Custom Taxonomies</title>
		<link>http://www.1stwebdesigner.com/wordpress/essential-guide-wordpress-custom-taxonomies/</link>
		<comments>http://www.1stwebdesigner.com/wordpress/essential-guide-wordpress-custom-taxonomies/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 21:00:03 +0000</pubDate>
		<dc:creator>Cosmin Negoita</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[taxonomies]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=16526</guid>
		<description><![CDATA[In general, taxonomies are used to arrange, classify and group things. By default, Taxonomies in WordPress are tags and categories that WordPress is using for the posts.  Apart from these two, WordPress makes it possible for theme developers to create their own taxonomies which are created within the functions.php theme file. This is what we [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.1stwebdesigner.com/wordpress/essential-guide-wordpress-custom-taxonomies/"><img class="alignleft size-full wp-image-17617" title="wordpress-custom-taxonomies" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/06/wordpress-custom-taxonomies.jpg" alt="" width="150" height="150" /></a>In general, taxonomies are used to arrange, classify and group things. By default, Taxonomies in WordPress are tags and categories that WordPress is using for the posts.  Apart from these two, WordPress makes it possible for theme developers to create their own taxonomies which are created within the <strong>functions.php</strong> theme file. This is what we are going to cover today. We will learn how to work with Custom WordPress taxonomies.<span id="more-16526"></span></p>
<p>Recently, I&#8217;ve started working on my portfolio WordPress theme, and I needed to define different information for each project/template, like price, colors, style, etc. For this thing, I needed to create three more taxonomies which are looking like this:</p>
<p><img class="alignnone size-full wp-image-16532" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/06/tax1.png" alt="WordPress Custom Taxonomies Example" width="500" height="517" /></p>
<h2>Creating a new taxonomy</h2>
<p>This is as simple as it is to look at the picture above. All you have to do is to copy the code below, in your <strong>functions.php. </strong>If your theme doesn&#8217;t have one, which I don&#8217;t think it hasn&#8217;t already one, just create the file yourself. Now, this is the code you have to write for each taxonomy you are creating:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php

register_taxonomy('test', 'post', array(
'hierarchical' =&gt; false,  'label' =&gt; 'test',
'query_var' =&gt; true, 'rewrite' =&gt; true));

?&gt;
</pre>
<p>Just replace &#8220;test&#8221; with the name of the taxonomy you wish to create. That&#8217;s how you create custom taxonomies. The&#8217;ll just appear in the Dashboard below the <strong>Post Tags.</strong></p>
<h2>Using the new taxonomies</h2>
<p>We have created them, but as well as tags and categories, you need some code if you want to output them in your article. That&#8217;s a little code snippet that goes into your WordPress loop, just like the post tags and categories:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php echo get_the_term_list($post-&gt;ID, 'people', 'People: ', ', ', ''); ?&gt;
</pre>
<h2>See it yourself</h2>
<p>Below are some examples of what we were talking about in this tutorial:</p>
<ul>
<li><a href="http://popcritics.com">PopCritics.com</a> is using custom taxonomies to output different details about the movies. See the <em><strong>Genre(s), Actor(s), etc&#8230;</strong></em></li>
<li><a href="http://typechart.com">TypeChart.com</a> is another great example of WordPress site that is making good use of taxonomies for finding font styling. You can see that in the sidebar.</li>
<li><a href="http://www.sohtanaka.com/web-design-portfolio/">Soh Tanaka</a>&#8216;s portfolio is also using taxonomies to output details on projects. Observe the <strong><em>Client, Date, URL, Tasks, etc&#8230;</em></strong></li>
</ul>
<p><strong><em><span style="font-style: normal; font-weight: normal;">I hope you have understood what taxonomies are. I&#8217;m sure you have heard about them before, but never wondered what they are, but what about using them for creating a nice t-shirt store?</span></em></strong></p>
<h2><strong><em><span style="font-style: normal; font-weight: normal;">Using Custom Taxonomies to create a T-shirt store</span></em></strong></h2>
<p><strong><em><span style="font-style: normal; font-weight: normal;"><img class="alignleft size-full wp-image-17159" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/06/store.png" alt="tshirt store photo" width="200" height="150" /></span></em></strong></p>
<p><strong><em><span style="font-style: normal; font-weight: normal;">Now that you have learned how to use custom taxonomies, we will use them for creating a T-shirt store. This won&#8217;t be a fully functional one, we will just build up the part that is using custom taxonomies.</span></em></strong></p>
<h3><strong><em><span style="font-style: normal; font-weight: normal;">1. Preparations</span></em></strong></h3>
<p><strong><em><span style="font-style: normal; font-weight: normal;">First of all we need a theme. We will use the new WordPress 3.0 default theme, called Twenty Ten. In order to get this theme and have it properly working, you need to <a href="http://wordpress.org/download/release-archive/">download WordPredd 3.0 RC2</a>. To get this version, scroll down to the bottom of the page, and the last one should be WP 3.0 RC2. Do not be worried working with WP 3.0, it has the same template tags.</span></em></strong></p>
<p><strong><em><span style="font-style: normal; font-weight: normal;">Next, you will need a local server, so the best way to create it, is using <a href="http://www.wampserver.com/en/download.php">WAMP</a>, or just build up your own environment following <a href="http://www.1stwebdesigner.com/tutorials/how-to-setup-local-web-server-with-latest-apache-php-and-mysql-packages/">this previous tutorial</a> on 1stWebDesigner.</span></em></strong></p>
<p><strong><em><span style="font-style: normal; font-weight: normal;">Now that you have your local server up and running, just install WordPress.</span></em></strong></p>
<h3><strong><em><span style="font-style: normal; font-weight: normal;">2. Editing the Twenty Ten theme</span></em></strong></h3>
<p>Now we need to create our custom taxonomies. First of all, think about what custom taxonomies you will need. For a T-shirt store we need to provide:</p>
<ul>
<li>size details</li>
<li>price</li>
<li>brand</li>
</ul>
<p>So, just open up the Twenty Ten <strong>functions.php</strong> file and create those custom taxonomies. I suggest to write the code at the end of the file for avoiding to break the default functions that the theme has. You can see the code that you will need and as It is, without any PHP tags:</p>
<pre class="brush: php; title: ; notranslate">

// Custom taxonomy for Size
register_taxonomy('Size', 'post',  array(
'hierarchical' =&gt; false, 'label' =&gt; 'Size',
'query_var' =&gt;  true, 'rewrite' =&gt; true));

// Custom taxonomy for Price
register_taxonomy('Price', 'post',  array(
'hierarchical' =&gt; false, 'label' =&gt; 'Price',
'query_var'  =&gt; true, 'rewrite' =&gt; true));

// Custom taxonomy for Brand
register_taxonomy('Brand', 'post',  array(
'hierarchical' =&gt; false, 'label' =&gt; 'Brand',
'query_var'  =&gt; true, 'rewrite' =&gt; true));
</pre>
<p>After creating the custom taxonomies, we need to modify the loop too. So this will be a little difficult, because you need to take care to not break any of the theme&#8217;s code. Don&#8217;t worry, I&#8217;ll guide you through this.</p>
<p><strong>Modifying the loop. </strong>Open up the <strong>index.php</strong> file from the 2010 theme. After you have opened it, you will see a tag that is calling the loop.php file:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php
 /* Run the loop to output the posts.
 * If you want to  overload this in a child theme then include a file
 * called  loop-index.php and that will be used instead.
 */
 get_template_part( 'loop', 'index' );
 ?&gt;
</pre>
<p>We will need to completely delete this, and create a  our own loop. So, instead loop tag, copy and paste this following code:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php if (have_posts()) : while (have_posts()) : the_post();  ?&gt;
&lt;div id=&quot;post-&lt;?&lt;span class=&quot;&gt;
&lt;pre&gt;&lt;?php the_ID(); ?&gt;&quot; &gt;&lt;/pre&gt;
&lt;/div&gt;
 &lt;h1&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;/a&gt;
&lt;div&gt;
 &lt;!--Insert custom field and custom taxonomies code here--&gt;
&lt;pre&gt;&lt;?php wp_link_pages( array( 'before' =&gt;  '&lt;/pre&gt;
&lt;div&gt;' . __( 'Pages:', 'twentyten' ), 'after' =&gt;  '&lt;/div&gt;
' ) ); ?&gt;
 &lt;/div&gt;&lt;!-- .entry-content  --&gt;
&lt;/div&gt;
&lt;pre&gt;&lt;?php endwhile; else: ?&gt;&lt;/pre&gt;
&lt;div id=&quot;post-&lt;?&lt;span class=&quot;&gt;
&lt;pre&gt;&lt;?php the_ID(); ?&gt;&quot; &gt;&lt;/pre&gt;
&lt;/div&gt;
 &lt;h1  class=&quot;entry-title&quot;&gt;Nothing here...&lt;/h1&gt;
&lt;div  class=&quot;entry-content&quot;&gt;
Sorry, no T-shirts avaiable for  sale. Try coming back later.
 &lt;/div&gt;&lt;!--  .entry-content --&gt;
&lt;/div&gt;
&lt;?php endif; ?&gt;
</pre>
<p>This is the loop that we will use. The ID and class are some theme specific styles. You have to notice that I have removed the meta data. Now, we will need to add the codes that will retrieve our custom taxonomies and we will need to make use of custom fields too, to retrieve t-shirt thumbnail. Add them exactly where you see the HTML comment in the above code. Now, here&#8217;s the code that we need:</p>
<pre class="brush: php; title: ; notranslate">

&lt;img src=&quot;ID, 'post-icon', true);  ?&gt;&quot; alt=&quot;Icon for Post #&quot;  /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;?php echo get_the_term_list($post-&gt;ID,  'Size', 'Size: ', ', ', ''); ?&gt;&lt;/li&gt;
&lt;li&gt;&lt;?php echo  get_the_term_list($post-&gt;ID, 'Price', 'Price: ', ', ', '');  ?&gt;&lt;/li&gt;
&lt;li&gt;&lt;?php echo get_the_term_list($post-&gt;ID,  'Brand', 'Brand: ', ', ', ''); ?&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;?php the_content(); ?&gt;
</pre>
<p>Notice that the custom field name is &#8220;thumb&#8221;. For using this custom field you need to create a new one with the name thumb, and the value of it is the link to your thumb. Now that we have everything set, what about trying to publish a sample post. Take a look at mine:</p>
<p><img class="alignnone size-full wp-image-17167" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/06/sample.png" alt="" width="570" height="227" /></p>
<h2>Conclusion</h2>
<p>So, you have learned how to use custom taxonomies, and you have created a little T-shirt store. Well, not a fully functional one, but it&#8217;s a good start :)</p>
<p>If you have any questions regarding this tutorial please do not hesitate to ask via comments. I&#8217;ll try to solve all your problems. Thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/wordpress/essential-guide-wordpress-custom-taxonomies/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>How to Create Your first WordPress Theme: Part 2</title>
		<link>http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-2-2/</link>
		<comments>http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-2-2/#comments</comments>
		<pubDate>Fri, 21 May 2010 10:15:36 +0000</pubDate>
		<dc:creator>Cosmin Negoita</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=14815</guid>
		<description><![CDATA[This is the second part of the &#8220;How to Create Your first WordPress Theme&#8221; tutorial series. Just in case you have missed the first part, please go here and start reading. You can Download source files of this tutorial or Live preview this theme. As I promised in the first part of this tutorial, we [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-15211" href="http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-2-2/attachment/part2/"><img class="alignleft size-full wp-image-15211" title="part2" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/05/part2.png" alt="" width="150" height="150" /></a>This is the second part of the &#8220;How to Create Your first WordPress Theme&#8221; tutorial series. Just in case you have missed the first part, please go <a href="http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-1/">here</a> and start reading.</p>
<p>You can <a href="http://cssfactory.net/layout7part2.zip">Download source files</a> of this tutorial or <a href="http://cssfactory.net/demonstration/layout7part2/">Live preview</a> this theme.</p>
<p>As I promised in the first part of this tutorial, we will do some stuff that will make your blog theme more interesting and useful. I&#8217;m re-writing the list with what we will cover in this part:<span id="more-14815"></span></p>
<ul>
<li>Widgetizing your sidebar</li>
<li>Making a working search form</li>
<li>Using the single page template: comments, author details</li>
<li>Using custom fields for showing an image for each article</li>
</ul>
<h2>1. Widgetizing the Sidebar</h2>
<p>Having a widget-ready theme is the most important thing of a blog theme. It doesn&#8217;t matter for the reader but it helps you a lot. How a widget-ready theme is helping you? Well, imagine that you want a lot of things to be displayed in the sidebar. Think that you will have some lists like friends, archive, categories, tag cloud, advertising area, etc. It would be easy to write markup in the sidebar.php file, but it would be more easy letting WordPress for handling this. Having a widget-ready theme is a big advantage because you can add text, lists and advertising area within WordPress admin panel.</p>
<p>But enough with talking, let&#8217;s get started! Open your <strong>sidebar.php</strong> file that you have coded in the first part of this tutorial. Now, we&#8217;ll have to decide what pieces of code will stay even if the widgets are turned on. Widgetizing the sidebar makes a condition like: if widgets are available, show widgets and chosen sidebar markup, else, show original sidebar markup. Below are the widget tags, without any code in them:</p>
<pre class="brush: php; title: ; notranslate">

&lt;!--Code that will stay even if the widgets are used--&gt;
&lt;?php  /*  Widgetized sidebar, if you have the plugin installed. */
 if (  !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) :  ?&gt;
&lt;!--Code to be replaced by WordPress--&gt;
&lt;?php endif; ?&gt;
</pre>
<p>Maybe this clears everything for you. The comments are very explanatory, so now we just need to use it with our sidebar markup. So, you should decide what code will remain even if the widgets are used. Normally, the search box have to always be there. Of course you can let WordPress add it but this will stop you from any additional customization to the search form elements:</p>
<pre class="brush: php; title: ; notranslate">

&lt;div id=&quot;navigation&quot;&gt;
&lt;p&gt;&lt;strong&gt;Navigation  Here&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;&lt;?php  bloginfo('url'); ?&gt;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;?php  wp_list_pages('title_li='); ?&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div  id=&quot;extra&quot;&gt;
&lt;form id=&quot;searchform&quot; method=&quot;get&quot; action=&quot;&lt;?php  bloginfo('home'); ?&gt;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;s&quot; id=&quot;s&quot; size=&quot;15&quot;  /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;&lt;?php  esc_attr_e('Search'); ?&gt;&quot; /&gt;
&lt;/form&gt;
&lt;?php  /* Widgetized  sidebar, if you have the plugin installed. */
 if (  !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) :  ?&gt;
&lt;p&gt;&lt;strong&gt;Categories&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;?php  wp_list_categories('title_li='); ?&gt;
&lt;/ul&gt;
&lt;?php endif;  ?&gt;
&lt;/div&gt;
</pre>
<p>I&#8217;ll stop here for a moment. I added a search form, which has WordPress specific values. If you remove them, the search form won&#8217;t work:</p>
<pre class="brush: php; title: ; notranslate">

&lt;form id=&quot;searchform&quot; method=&quot;get&quot; action=&quot;&lt;?php bloginfo('home');  ?&gt;&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;s&quot; id=&quot;s&quot; size=&quot;15&quot; /&gt;&lt;br  /&gt;
&lt;input type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e('Search'); ?&gt;&quot;  /&gt;
&lt;/form&gt;
</pre>
<p>The code I have been showing you previously, is the markup of the sidebar.php file, along with the widget tags. The condition for what I&#8217;ve written there, is the following: if there aren&#8217;t any widgets in use, show the categories, else, show the widgets you are activating.</p>
<p>We aren&#8217;t ready yet. This code won&#8217;t work if we do not add some functions. Normally, for not modifying the WordPress core files, we add new functions to the <strong>functions.php</strong> file that you will have to create. For creating the function for the widgets, add the following code to your new functions.php file:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php

if ( function_exists('register_sidebar')  )
 register_sidebar(array(
 'before_widget' =&gt; '',
 'after_widget'  =&gt; '',
 'before_title' =&gt;  '&lt;p&gt;&lt;strong&gt;',
 'after_title' =&gt;  '&lt;/strong&gt;&lt;/p&gt;',
 ));

?&gt;
</pre>
<p>You need some explanation, right? Well, between the apostrophes you need to write your needed markup. Before and after widget could be used div tags, of course if your template needs them. For our current layout, we won&#8217;t add anything. The same thing happens for the title of each widget (e.g. Categories) which are wrapped by the paragraph and strong tags. You got it? Hope you did. This is everything you need to know about widgetizing the sidebar.</p>
<h2>2. Adding a &#8220;Read more&#8221; link</h2>
<p>Creating a Read more link is used for the blogs who do not want to show all the content of their articles on the front page. There are many ways we can achieve something like this:</p>
<h3>2.1 The WordPress &#8220;more&#8221; tag</h3>
<p>The more tag is activated by a little button when adding a new post from the WordPress admin panel. You can press <strong>ALT+Shift+T</strong> or click the following button:</p>
<p><img class="aligncenter size-full wp-image-15214" title="Step 2.1-wordpress-theme-tutorial-more-tag" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/05/more1.png" alt="Step 2.1-wordpress-theme-tutorial-more-tag" width="508" height="94" /></p>
<p>If you do not know how to use it, I&#8217;ll explain you how to. Let&#8217;s say you have 2 paragraphs of text, but you want to show on the frontpage only the first paragraph. Click after the first paragraph and then click the shown button. You will see a dotted line with a little tag where it says &#8220;more&#8221;. All the content before this line will be shown.</p>
<p>But there is something else. You need to modify the content tag from the index.php file. As the source files from the first part do not have any parameter set to the tag, you will need to add it. Copy and paste the following code instead of the standard content tag:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php the_content(__('Read more...')); ?&gt;
</pre>
<p>Do not remove the paragrpah tags. Just the content tag needs to be modified. Now in each article where you place the more tag from the WordPress will show a &#8220;Read more&#8221; link. Go and try it!</p>
<h3>2.2 Using the excerpt</h3>
<p>Another way to achieve this is by using the excerpt. This works a bit diffrent. When publishing a new article in WordPress, you will see a box where it says &#8220;Excerpt&#8221; If you still have the content more tag used, the excerpt will automatically use the content before the dotted line. If you won&#8217;t use it from the WordPress Editing screen, it will remain empty.</p>
<p>If so, you will be able to write something different, like a short introduction or description. Let&#8217;s say you have some content in the article, and just write in the excerpt a random description.</p>
<p>If you publish the text, you will notice that you will get the whole content on the respective article. For getting the text you have written in the Excerpt box, you will need to modify the <strong>index.php</strong> loop. So instead of:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php the_content(__('Read more...')); ?&gt;
</pre>
<p>You will need to add the excerpt tag which is the following:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php the_excerpt(); ?&gt;
</pre>
<p>Now, take a look and see the difference.</p>
<p><strong>2.3 Using a limitation plugin</strong></p>
<p>Using such a plugin sometimes is easier for you. What this plugin does? Well, depending on each plugin, it can limit your content to word number, letter number or just show the first paragraph of the article. You can see a list of 3 such of plugins:</p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/content-and-excerpt-word-limit/">Content and Excerpt Word Limit</a></li>
<li><a href="http://www.jenst.se/2007/12/03/wp-limit-posts-automatically/">WP Limit Posts Automatically</a></li>
<li><a href="http://www.divinedeveloper.com/09/24/wordpress-content-limit/">A tutorial about limiting the content</a></li>
</ul>
<p>Now, you just need to decide which one is best for you.</p>
<h2>3. Comments-template: using comments in WordPress</h2>
<p>When It comes to develop a new WordPress theme, the part I hate the most is working on the comments. It&#8217;s not because it&#8217;s hard, it&#8217;s because I need to make a lot of stylings to achieve a nice comment area. I won&#8217;t get into styling because it relies on your creativity and CSS skill. I will only show you how to use the comments in a theme and what the used tags are doing. I suggest learning some basics of PHP before editing the <strong>comments.php</strong> file, because you&#8217;ll need some basic knowledge about PHP to code your own comments. For now, I&#8217;ll just show you how to use them. So let&#8217;s get started by opening the comments.php file from the WordPress Classic theme which is located in the <strong>wp-content/themes/classic</strong> directory.</p>
<p>Now, save the comments.php file in your <strong>layout07</strong> directory. Ok, you won&#8217;t understand much things in this file if you don&#8217;t have some basic PHP knowledge. For now leave the file intact and open the <strong>single.php</strong> file and add after the  content tag the following tag:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php comments_template(); ?&gt;
</pre>
<p>This will enable the comments in your theme. You will see a heading saying &#8220;No Comments&#8221; and below, a form with a heading saying &#8220;Leave a comment&#8221;. You can either leave a comment as a guest, or just sign in to WordPress and leave a comment as an admin (or user). Now, the most important tags you need to know when editing the comments.php file are the following:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php comment_author_link() ?&gt; &lt;!-- The author of the comment  --&gt;
&lt;?php echo get_avatar( $comment, 32 ); ?&gt; &lt;!-- The  commenter's avatar (or Gravatar) --&gt;
&lt;?php comment_text() ?&gt; &lt;!--  The commenter's comment text --&gt;
&lt;?php comment_date() ?&gt; &lt;!-- The  date when the comment have been posted --&gt;
&lt;?php comment_time() ?&gt;  &lt;!-- The time when the comment have been posted --&gt;
&lt;?php  edit_comment_link(__(&quot;Edit This&quot;), ' |'); ?&gt; &lt;!-- The edit link for the  comment (if you want to edit something in your comment) --&gt;
</pre>
<p>Now, constructing a new comment structure is very easy, but you need to pay attention for not breaking the PHP code. The default structure of the comment is the following:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php if ( have_comments() ) : ?&gt;
&lt;ol id=&quot;commentlist&quot;&gt;

&lt;?php foreach ($comments as $comment) : ?&gt;
 &lt;li &lt;?php  comment_class(); ?&gt; id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot;&gt;
 &lt;?php  echo get_avatar( $comment, 32 ); ?&gt;
 &lt;?php comment_text()  ?&gt;
 &lt;p&gt;&lt;cite&gt;&lt;?php comment_type(_x('Comment', 'noun'),  __('Trackback'), __('Pingback')); ?&gt; &lt;?php _e('by'); ?&gt; &lt;?php  comment_author_link() ?&gt; — &lt;?php comment_date() ?&gt; @ &lt;a  href=&quot;#comment-&lt;?php comment_ID() ?&gt;&quot;&gt;&lt;?php comment_time()  ?&gt;&lt;/a&gt;&lt;/cite&gt; &lt;?php edit_comment_link(__(&quot;Edit This&quot;), ' |');  ?&gt;&lt;/p&gt;
 &lt;/li&gt;

&lt;?php endforeach; ?&gt;

&lt;/ol&gt;

&lt;?php else : // If there are no comments yet ?&gt;
 &lt;p&gt;&lt;?php  _e('No comments yet.'); ?&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
</pre>
<p>So now, let me explain. Starting from the first line: If there are comments left to your article, your comments will be shown with the giveen structure within foreach PHP function, else (if no comments are posted) show a text with &#8220;No comments yet.&#8221;. For changing the look of your comments, you need to work just inside the foreach function. I&#8217;ll show you how to change the look of your comments, very easily.</p>
<p>Delete the &lt;ol&gt; tags and everything inside the foreach function. You&#8217;ll  just be left with something like this:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php if ( have_comments() ) : ?&gt;

&lt;?php foreach ($comments as $comment) : ?&gt;

&lt;?php endforeach; ?&gt;

&lt;?php else : // If there are no comments yet ?&gt;
 &lt;p&gt;&lt;?php  _e('No comments yet.'); ?&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
</pre>
<p>Next, wrap the foreach function with a div id &#8220;comments&#8221;, like the default structure were wrapped by &lt;ol&gt; tags. Now, add the following code withing the foreach function:</p>
<pre class="brush: php; title: ; notranslate">

&lt;div id=&quot;comments&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;?php  comment_author_link() ?&gt; said this on &lt;?php comment_date() ?&gt; at  &lt;?php comment_time() ?&gt; &lt;?php edit_comment_link(__(&quot;Edit This&quot;), ' |');  ?&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php comment_text()  ?&gt;&lt;/p&gt;
&lt;/div&gt;
</pre>
<p>Just take a look on how the comments are displayed now. I have removed some tags because you won&#8217;t need them as a beginner WordPress theme developer. I added div&#8217;s instead lists because it&#8217;s more clean. The class and the id were assigned for further customization via CSS. Now, if you have made the changes as I told you, you should edn up with something like this:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php if ( have_comments() ) : ?&gt;

&lt;div id=&quot;comments&quot;&gt;

&lt;?php foreach ($comments as $comment) : ?&gt;

&lt;div class=&quot;comment&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;?php  comment_author_link() ?&gt; said this on &lt;?php comment_date() ?&gt; at  &lt;?php comment_time() ?&gt; &lt;?php edit_comment_link(__(&quot;Edit This&quot;), ' |');  ?&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php comment_text()  ?&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;?php endforeach; ?&gt;

&lt;/div&gt;

&lt;?php else : // If there are no comments yet ?&gt;
 &lt;p&gt;&lt;?php  _e('No comments yet.'); ?&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
</pre>
<p>For finding more information about manipulating the comments.php files go to the WordPress Codex and start looking for what you need. All that I&#8217;ve covered here is just basic stuff. Hope you&#8217;ve understood everything of what I&#8217;ve told you!</p>
<h2>4. Using custom fields for showing an image for each article</h2>
<p>Custom fields are one of the most important feature of WordPress. If you master the custom fields, you can create stunning WordPress functionalities like displaying an image for each article (like what I&#8217;ll be teaching you), displaying a certain message or link to your visitors (like a live preview and a demo button or even a source link for your article).</p>
<p>Where can you find the custom field box? The cutom fields box is located under the  Send Trackbacks box, in the <strong>Post &gt; Add post</strong> in the admin panel:</p>
<p><img class="aligncenter size-full wp-image-15215" title="Step 4-wordpress-theme-tutorial-custom-field" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/05/cf1.png" alt="Step 4-wordpress-theme-tutorial-custom-field" width="413" height="394" /></p>
<p>Using the custom fields isn&#8217;t so hard. You just have to learn the tag that calls a specified custom filed name. The tag is the following:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php echo get_post_meta($post-&amp;gt;ID, 'custom field name', true);  ?&gt;
</pre>
<p>If you would write &#8220;image&#8221; instead of &#8220;custom field name&#8221;, WordPress will create a custom field with the name &#8220;image&#8221;, so any value you will give to the custom field, WordPress will output the value in the place where you have written your custom field tag. Not too clear for you? Let&#8217;s apply the custom field tag to create a nice thumbnail for each post! We will use an image tag which uses as source a link introduced by the custom field:</p>
<pre class="brush: php; title: ; notranslate">

&lt;img src=&quot;&lt;?php echo get_post_meta($post-&amp;gt;ID, 'image', true); ?&gt;&quot;  alt=&quot;&lt;?php the_title(); ?&gt;&quot; /&gt;
</pre>
<p>This tag will be posted above the content tag inside the index.php and the single.php files. Now go and create a new custom field with the name &#8220;image&#8221; and add to the value a link to an image. You can see how I&#8217;ve done this in the following pic:</p>
<p><img class="aligncenter size-full wp-image-15216" title="Step 5-wordpress-theme-tutorial-custom-field-creation" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/05/cfc.png" alt="Step 5-wordpress-theme-tutorial-custom-field-creation" width="560" height="241" /></p>
<p>Just in case that you won&#8217;t attach a thumbnail to your post, the article will show you an image missing. So you may add a thumbnail to each article you are writing. This is everything you need to do!</p>
<h2>5. Author details: single page template and profile</h2>
<p>WordPress have some predefined functions to output the current author details. This can be useful if you want to show some details about you or other authors in the single page templates. WordPress is also creating a profile page for any author where you can show the author details: description and posts.</p>
<p>This may sound difficult, but it&#8217;s very easy, just like all other things in WordPress. You only need a tag or two (if you want the author name displayed too) to show up your auhor details on single page template (and also others). Place the following tags at the start or at the ending of the article loop (in the single.php file):</p>
<pre class="brush: php; title: ; notranslate">

&lt;p&gt;&lt;strong&gt;&lt;?php the_author_posts_link();  ?&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php the_author_description();  ?&gt;&lt;/p&gt;
</pre>
<p>The first line is for outputing the author&#8217; posts page link and the second is for outputing the description of the author (entered from Biographical Info from the profile within WordPress admin panel). You can wrap these codes by a div id &#8220;author&#8221; so you can style it if you want. So the loop would look like the following:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php if (have_posts()) : while (have_posts()) : the_post();  ?&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php the_permalink();  ?&gt;&quot;&gt;&lt;?php the_title();  ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Published on &lt;?php  the_time('m d Y'); ?&gt; by &lt;?php the_author(); ?&gt;&lt;/p&gt;
&lt;img  src=&quot;&lt;?php echo get_post_meta($post-&gt;ID, 'image', true); ?&gt;&quot;  alt=&quot;&lt;?php the_title(); ?&gt;&quot; /&gt;
&lt;p&gt;&lt;?php the_content();  ?&gt;&lt;/p&gt;
&lt;div id=&quot;author&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;?php  the_author_posts_link(); ?&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php  the_author_description(); ?&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;?php  comments_template(); // Get wp-comments.php template ?&gt;
&lt;?php endwhile;  else: ?&gt;
&lt;p&gt;&lt;?php _e('Sorry, no posts matched your criteria.');  ?&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
</pre>
<p>Now, for creating the author profile page, you need to open the page.php file then save it as author.php. Now, delete the actual loop and everything within the content div and paste the following code:</p>
<pre class="brush: php; title: ; notranslate">

&lt;p&gt;&lt;strong&gt;&lt;?php the_author_posts_link();  ?&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php the_author_description();  ?&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;?php if (have_posts()) : while  (have_posts()) : the_post(); ?&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;?php  the_title(); ?&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Published on &lt;?php  the_time('m d Y'); ?&gt;&lt;/li&gt;
&lt;?php endwhile; else:  ?&gt;
&lt;p&gt;&lt;?php _e('Sorry, no posts matched your criteria.');  ?&gt;&lt;/p&gt;
&lt;?php endif; ?&gt;
&lt;ul&gt;
</pre>
<p>As you see, the author details are outside the loop. Then, we would like to display the posts that the current author have written so far. We are creating the loop, but this time we will show just the article title and the date when it was published. That&#8217;s it now. Save your file and go to test it!</p>
<h2>That&#8217;s it!</h2>
<p>Well, people, these are all the things I&#8217;ve wanted to cover as basics. Just leave comments requesting other things, and probably I will cover them in upcoming tutorials. Have fun with creating WordPress, and if i&#8217;ve helped someone to develop a nice theme, let me know! More to come on 1STWD&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-2-2/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>How to Create Your first WordPress Theme: Part 1</title>
		<link>http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-1/</link>
		<comments>http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-1/#comments</comments>
		<pubDate>Fri, 07 May 2010 10:00:32 +0000</pubDate>
		<dc:creator>Cosmin Negoita</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.1stwebdesigner.com/?p=12441</guid>
		<description><![CDATA[WordPress is the most popular and the best (in my opinion) blogging platform, created by Automattic. It&#8217;s really easy to use and it&#8217;s very powerful, giving you the opportunity to build any kind of site, from blogs to shopping carts and CMS&#8217;s.  In this series of tutorials, we are going to create our first WordPress [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-13526" href="http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-1/attachment/wp-theme-tutorial/"><img class="alignleft size-full wp-image-13526" title="wp-theme-tutorial" src="http://cdn1.1stwebdesigner.com/wp-content/uploads/2010/04/wp-theme-tutorial.png" alt="" width="150" height="150" /></a><a href="http://wordpress.org">WordPress</a> is the most popular and the best (in my opinion)  blogging platform, created by Automattic. It&#8217;s really easy to use and it&#8217;s very  powerful, giving you the opportunity to build any kind of site, from blogs to  shopping carts and CMS&#8217;s.  In this series of tutorials, we are going to create our first WordPress theme. For this tutorial you need to have a little more than  basic knowledge about HTML and CSS. Let&#8217;s get started.<span id="more-12441"></span>You can <a href="http://cssfactory.net/download/layout7.rar">Download source  files</a> and you can also <a href="http://cssfactory.net/demonstration/layout07">Live preview</a> the theme here. It&#8217;s a basic css layout so it will be easy for beginners to convert it into a working WordPress theme.</p>
<h2>What we need</h2>
<p>WAMP/XAMPP Server (or similar software) - <a href="http://www.wampserver.com/en/download.php">Download</a></p>
<p>WordPress 2.9.2 (latest version, recommended) &#8211; <a href="http://wordpress.org/download/">Download</a></p>
<h2>Getting started &#8211; creating the working environment</h2>
<p>First thing first, you need to install WAMP Server. After installing WAMP,  download and copy the WordPress files in the <strong>www</strong> directory from  your WAMP folder. Start WAMP Server, click on the icon in the task bar, and a  pop-up list show appear, then select <strong>phpMyAdmin</strong>.</p>
<p>Now, create a new database. Give it any name, but you need to keep it in mind  as we need it at the WP installation. As for now, we are done with WAMP Server,  just leave it running.</p>
<h2>WordPress Installation</h2>
<p>After copying all the files, you need to install WordPress. Enter on the  address where you have put the WP files. The address would be exactly, without  any www or http, <strong>localhost </strong>or<strong> localhost/WordPress. </strong>After accessing the address, the installation may start.</p>
<p>Click &#8220;Create a Configuration File&#8221;. After this, you will see some listing of  things you need to know. I&#8217;ll just tell you what you need:</p>
<ol>
<li>Database name: your given name of the database we&#8217;ve created earlier</li>
<li>Database username: this should be &#8220;root&#8221; if you set it on your computer.</li>
<li>Database password: there is no password set.</li>
<li>Database host: localhost</li>
<li>Table prefix: for now, leave it as it is.</li>
</ol>
<p>Now, just fill in the fields with the required information, and go further!  After filling up the fields, next give any name to your blog, and write your  e-mail address.</p>
<p>Now, copy the auto generated password, and paste it in the password field at  the site login. Now, because you cannot keep that weird password in mind, go the upper right corner of the site and click on &#8220;admin&#8221;. You should see a page  where you have your account info. You can modify anything there, but for now we  are setting a new and easier password.</p>
<p>Go to the bottom where it says &#8220;New password&#8221; and set your new password.</p>
<p>Good, now you have WP installed, but we have a lot more things to do.</p>
<h2>1. Planning the theme layout</h2>
<p>When I&#8217;m starting a new project on developing a WordPress theme, as everyone  should do, I first build my HTML/CSS template. This is easier because you also  learn how to convert a simple HTML template into a fully functional WordPress  theme. So i won&#8217;t go through building the template, considering you already know  how to build your own. I&#8217;ll just use a simple layout from Free-CSS.com in this  tutorial. Go <a href="http://www.free-css.com/free-css-layouts/page1.php">here</a> and download  the #7 template.</p>
<h2>2. Starting the conversion</h2>
<p>When I&#8217;m making a theme, I&#8217;m always copying code snippets from a default  WordPress theme (because i cannot remember all of them). I use the WordPress  Classic theme, but you can also use a cheat sheet. The best one i&#8217;ve found is  the one created by <a href="http://ekinertac.com/wp-content/uploads/2009/07/Wordpress-Cheat-Sheet.pdf">Ekinertac</a>.  After it opens in the PDF format, save it in your computer (you may need it when  you do not have access to the internet).</p>
<p>All the contents from the sheet are the most used functions from WordPress,  and the ones that you need to create a basic WP theme.</p>
<p>A thing that you have to notice is that WordPress is using PHP. Even if you  aren&#8217;t a PHP master, or you have absolutely no idea what PHP is, you are still  able to create a basic theme. When creating a theme, you need to know just tags  and what they are doing, so do not worry about PHP.</p>
<h3>2.1 Making the theme recognizable by WordPress</h3>
<p>A very important part of a WordPress theme is the CSS file. In the CSS file are  written some lines that WordPress is using to g a theme. First, you need  to rename the <strong>styles.css</strong> to <strong>style.css</strong> as  WordPress is search for <strong>style</strong> not <strong>styles</strong>. Copy  and paste these lines at the start of your CSS file:</p>
<pre class="brush: css; title: ; notranslate">/*
Theme Name: Free-CSS template WP version
Theme URI: &lt;a href=&quot;http://free-css.com/&quot;&gt;http://free-css.com&lt;/a&gt;
Description: A very basic  WP theme based on a simple CSS layout from Free-CSS.com
Version: 1
Author:  &gt;your name&lt;
Author URI: &gt;your site url&lt;
Tags: free, css,  tutorial, simple, basic
*/</pre>
<p>You can change everything that is located after the &#8220;:&#8221; dots. Save your CSS file as we won&#8217;t need it because we are just trying to give to the HTML template functionality.</p>
<h3>2.2 Converting the HTML file</h3>
<p>After you set up your CSS file, we need to go and change some things in the  <strong>index.html</strong> file. First of all, clear all the sample text.<br />
Save you file as index.php. We do not need the sample text anymore as we will introduce our own text from WordPress later.</p>
<p>Now, we need to make some declarations for the WP theme. We need to make the title dynamic and to set the stylesheet path. These lines will help you:</p>
<pre class="brush: php; title: ; notranslate">
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type');  ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;&quot; /&gt;
&lt;title&gt;&lt;?php wp_title('&amp;laquo;', true,  'right'); ?&gt; &lt;?php bloginfo('name'); ?&gt;&lt;/title&gt;
&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;@import url(  &lt;?php bloginfo('stylesheet_url'); ?&gt; );&lt;/style&gt;
</pre>
<p>Now, we will start with the header of the design. For adding your blog&#8217;s name with a link to your homepage in the header, we will use this line of code:</p>
<pre class="brush: php; title: ; notranslate">&lt;h1&gt;&lt;a href=&quot;&lt;?php bloginfo('url'); ?&gt;&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;</pre>
<p>The first PHP tag is used for retrieving the blog&#8217;s homepage link and the second is for the blog&#8217;s name (the one you set in the installation).</p>
<p>Now we&#8217;re going further for the loop. The loop is a block of code that will repeat for each post from WordPress. We will use the loop to construct the article. I&#8217;ll cover more about the loop in the second part, where we will use it for other things too.</p>
<p>Now, all your code is wrapper by some loop specific tags. Here they are:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;

&lt;!--Code to be repeated here--&gt;

&lt;?php endwhile; else: ?&gt;
&lt;?php endif; ?&gt;</pre>
<p>Next, we will start constructing the article structure. We will need a title, some info about the dat when the article was published and it&#8217;s author.</p>
<p>The following line makes the article title:</p>
<pre class="brush: php; title: ; notranslate">
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
</pre>
<p>The first PHP tag is for the article&#8217;s link and the second is for the article title. These tags are kinda self-explanatory. We&#8217;re moving further for the meta data (date, author). Copy and paste the following code under the article title code:</p>
<pre class="brush: php; title: ; notranslate">
&lt;p&gt;Published on &lt;?php the_time('F d, y'); ?&gt; by &lt;?php the_author(); ?&gt; in &lt;?php the_category(','); ?&gt;&lt;/p&gt;
</pre>
<p>First tag is for retrieving the date. The date tag have some parameters. These parameters are setting the date format (month, day, year). You can add characters like &#8220;-&#8221; or &#8220;.&#8221; or making something like &#8220;Month 02 Day 15 Year 1990&#8243;, it&#8217;s up to you! The second one, is for echoing the author of the post and the third, is for category or categories that the post is filed under.</p>
<p>Now, we will be placing the content tag. The content tag will output everything you write in a WordPress post:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php the_content(); ?&gt;</pre>
<p>The tag doesn&#8217;t need paragraphs because WordPress auto generates them for you. We&#8217;re finished with the loop. You can see the code pieces at the party:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
 &lt;p&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;Published on &lt;?php the_time('m d Y'); ?&gt; by &lt;?php the_author(); ?&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php the_content(); ?&gt;&lt;/p&gt;
 &lt;?php endwhile; else: ?&gt;
 &lt;p&gt;&lt;?php _e('Sorry, no posts matched your criteria.'); ?&gt;&lt;/p&gt;
 &lt;?php endif; ?&gt;</pre>
<p>Next, we will be going to code the sidebar.</p>
<p>We will start with the navigation. As you see in the CSS layout, the navigation  is located in the sidebar. It doesn&#8217;t matter because the technique is the same.  For creating a basic navigation you need these lines of code, which will placed  between the &lt;strong&gt;ul &lt;/strong&gt;tags:</p>
<pre class="brush: php; title: ; notranslate">&lt;li&gt;&lt;a href=&quot;&lt;?php bloginfo('url'); ?&gt;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;?php wp_list_pages('title_li='); ?&gt;</pre>
<p>You already know what the first PHP tag does. The second one, is listing the pages that WordPress generates. The parameter is for list title. Try removing it and see what&#8217;s happening.</p>
<p>This is all you need to do for getting a nice working navigation menu. Now, we will create the categories list. All the blogs have categories and we don&#8217;t want our theme to lack categories. We will just add this code between the div #extra tags:</p>
<pre class="brush: php; title: ; notranslate">
&lt;p&gt;&lt;strong&gt;Categories&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
 &lt;?php wp_list_categories('title_li='); ?&gt;
&lt;/ul&gt;
</pre>
<p>There is another listing tag but this one is listing the blog&#8217;s categories. I&#8217;ll cover more things relating the sidebar in part 2, where i will teach you how to make a theme widget-ready. That means you will introduce new blocks inside of WordPress, without coding anything.</p>
<p>But what about the footer? Shouldn&#8217;t it have some text in it? Well, we will write the copyright:</p>
<pre class="brush: php; title: ; notranslate">
&lt;p&gt;Copyright &amp;copy; 2010 &lt;a href=&quot;&lt;?php bloginfo('url'); ?&gt;&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;. All rights reserved.&lt;/p&gt;
</pre>
<p>As you see, we have introduced some tags, just like in the header, to output the blog&#8217;s title.</p>
<p>The theme is functional, but we will need to make some page templates for single post (where the comments will appear) and the page (where you could write some info about your blog). If you use the same code for the header footer and sidebar, your template would get messy. Let&#8217;s say that you want to add one more thing to your sidebar. You will have to modify 3 times for each page template. Well, for avoiding this, we will chop the markup.</p>
<p>For each section of the index.php file we will have a separate file. So we will have <strong>header.php</strong>, <strong>footer.php</strong> and <strong>sidebar.php</strong>. Now, we will be starting to chop!</p>
<p>Copy and then replace the following lines:</p>
<pre class="brush: php; title: ; notranslate">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;&quot; /&gt;
&lt;title&gt;&lt;?php wp_title('&amp;laquo;', true, 'right'); ?&gt; &lt;?php bloginfo('name'); ?&gt;&lt;/title&gt;
&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
@import url( &lt;?php bloginfo('stylesheet_url'); ?&gt; );
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;container&quot;&gt;
&lt;div id=&quot;header&quot;&gt;&lt;h1&gt;&lt;a href=&quot;&lt;?php bloginfo('url'); ?&gt;&quot;&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;
&lt;/h1&gt;&lt;/div&gt;
</pre>
<p>With the following line:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php get_header(); ?&gt;</pre>
<p>Your copied code needs to be placed in the header.php file. The same thing we will do with the footer and sidebar</p>
<p>Copy the following:</p>
<pre class="brush: php; title: ; notranslate">
&lt;div id=&quot;navigation&quot;&gt;
&lt;p&gt;&lt;strong&gt;Navigation Here&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
 &lt;li&gt;&lt;a href=&quot;&lt;?php bloginfo('url'); ?&gt;&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;?php wp_list_pages('title_li='); ?&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&quot;extra&quot;&gt;
&lt;p&gt;&lt;strong&gt;Categories&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
 &lt;?php wp_list_categories('title_li='); ?&gt;
&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>Paste them to sidebar.php then in the index.php file replace it with:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php get_sidebar(); ?&gt;</pre>
<p>Now, do the same thing with the footer. Copy the footer div and it&#8217;s contents, paste it in footer.php file, and then remove it in index.php with:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php get_footer(); ?&gt;</pre>
<p>You should have something like this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php get_header(); ?&gt;
 &lt;div id=&quot;wrapper&quot;&gt;
 &lt;div id=&quot;content&quot;&gt;
 &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
 &lt;p&gt;&lt;strong&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
 &lt;p&gt;Published on &lt;?php the_time('m d Y'); ?&gt; by &lt;?php the_author(); ?&gt;&lt;/p&gt;
 &lt;p&gt;&lt;?php the_content(); ?&gt;&lt;/p&gt;
 &lt;?php endwhile; else: ?&gt;
 &lt;p&gt;&lt;?php _e('Sorry, no posts matched your criteria.'); ?&gt;&lt;/p&gt;
 &lt;?php endif; ?&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 &lt;?php get_sidebar(); ?&gt;
 &lt;?php get_footer(); ?&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now you&#8217;re done with chopping the markup. We are going to create the page templates. We will create firstly the single template. Just save your index.php file as single.php. We won&#8217;t modify anything in this page yet. We will do it in part 2 where I will learn you how to create a comment form and how to list comments and other things like custom fields.</p>
<p>Now, for the static page, page template, delete the line where you have placed the meta data (the line with date, author and category tags). Then save the file as page.php. Being a page, we won&#8217;t need any info about the creation date or the author. We won&#8217;t even use comments on page because there is no point in it.</p>
<p>The last move we need to do is to print screen our template and save it in a canvas of 300 x 225 px and save it as screenshot.png in the root directory of your theme. This will be used in WordPress theme menu.</p>
<p>Well, we&#8217;re done with the first part. Go ahead and test your theme. If there is something you want to ask, do it via comments. Don&#8217;t forget that you can download the source files too.</p>
<h2>To be continued</h2>
<p>There are a lot of things to cover about WordPress. Making a theme isn&#8217;t so difficult, you just need to be patient. There are a lot of things that are needed to make a fully functional WordPress theme. That&#8217;s why, this tutorial will have a Part 2. Maybe there will be more parts, but i will let you know what I will be covering in the next part:</p>
<ul>
<li>Widgetizing the sidebar</li>
<li>Using the single page template: comments, custom fields, author details</li>
<li>Using custom fields for showing an image for each article</li>
<li>Making a nice and working search form</li>
</ul>
<p>Stay Tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.1stwebdesigner.com/tutorials/how-to-create-your-first-wordpress-theme-part-1/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
	</channel>
</rss>

