Announcement!

Bid Oh Bid Directory - Bid your link to get higher position now!

You are reading Make your Own Wordpress Theme - Part 5. To read other parts, click on the link below.

For sidebar, there are some Wordpress tags that we can use here. For an example, to display the pages, categories, archives, etc.

First what we will do is to put unordered list to make it easier to manage our sidebar. Here what I mean.

In sidebar id, we put the <ul> and <li> like this.

Code (php)
  1.  
  2. <div id="sidebar">
  3.  <ul>
  4.   <li>
  5.    our sidebar content goes here
  6.   </li>
  7.  </ul>
  8. </div> <!– close sidebar –>
  9.  

Because we can use CSS, so it will be better if do like this.

Code (php)
  1.  
  2. <div id="sidebar">
  3.  <ul>
  4.   <li>
  5.  
  6.    <h2>sidebar title</h2>
  7.     <ul>
  8.      <li>sidebar link1</li>
  9.      <li>sidebar link2</li>
  10.      <li>sidebar link3</li>
  11.     </ul>
  12.  
  13.   </li>
  14.  </ul>
  15. </div> <!– close sidebar –>
  16.  

So we can make each section has their own title and content. For an example, we display our site categories like this.

Code (php)
  1.  
  2. <div id="sidebar">
  3.  <ul>
  4.   <li>
  5.  
  6.    <h2>Categories</h2>
  7.           <ul><BR><?phpwp_list_cats(’sort_column=name&optioncount=1&hierarchical=0′); ?>
  8.     </ul>
  9.  
  10.   </li>
  11.  </ul>
  12. </div> <!– close sidebar –>
  13.  

Some of you may noticed that I did not include <li> tag for the Category. This is because Wordpress already list down the output in <li> and </li>. So we no need to put the <li>.

Some other Wordpress tags that you can use in sidebar.php

<?php wp_get_archives(’type=monthly’); ?>
- display Monthly Archives

<P><?phpwp_list_cats(’sort_column=name&optioncount=1&hierarchical=0′); ?>
- display our site categories

 

<?php get_links_list(); ?>
- list down our Blogroll

You can get more tags here, Wordpress Template Tags .

Here is the sidebar code that I make that you can use in your sidebar.php

Code (php)
  1.  
  2. <div id="sidebar">
  3.  <ul>
  4.   <li>
  5.  
  6.     <?phpwp_list_pages(’sort_column=menu_order&title_li=<h2>Pages</h2>’ ); ?>
  7.  
  8.  <li>
  9.  <h2>Archives</h2>
  10.   <ul>
  11.    <?php wp_get_archives(‘type=monthly’); ?>
  12.   </ul>
  13.  </li>
  14.  
  15.  <li>
  16.  <h2>Categories</h2>
  17.       <ul><BR><?phpwp_list_cats(’sort_column=name&optioncount=1&hierarchical=0′); ?>
  18.   </ul>
  19.  </li>
  20.  
  21.   </li>
  22.  </ul>
  23. </div> <!– close sidebar –>
  24.  

Next, Part 6 - Footer . [tags]diy, how to, skin, theme[/tags]

If you enjoyed this article, get latest updates via RSS feed or by email.

5 Responses to “Make your Own Wordpress Theme - Part 5”

  1. Cara buat Theme - Klik di Situ « Buat Duit Dari PC Anda
    August 4th, 2007 | 2:58 pm

    [...] - Part 2 4- Make your Own Wordpress Theme - Part 3 5- Make your Own Wordpress Theme - Part 4 6- Make your Own Wordpress Theme - Part 5 7- Make your Own Wordpress Theme - Part 6 8- Make your Own Wordpress Theme - Part [...]

  2. mr magoo
    March 29th, 2008 | 2:47 am

    i am getting this error:

    Parse error: parse error, unexpected ‘=’ in sidebar.php on line 4

    what does that mean?

  3. CypherHackz
    April 5th, 2008 | 11:34 am

    Can you send me your sidebar.php file to my email?

  4. Xevo
    May 12th, 2008 | 10:23 am

    Yeah, same error as mr magoo. I’ll try finding the error. ;]

  5. Xevo
    May 12th, 2008 | 10:29 am

    Found it, was a typo.

    Needs to be:

Leave a Reply