Free Templates

Free Templates for you

Make your Own WordPress Theme – Sidebar

leave a comment »

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.

  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.

  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.

  1. .
  2. <div id=”sidebar”>
  3. <ul>
  4. <li>
  5. .
  6. <h2>Categories</h2>
  7. <ul><BR><?phpwp_list_cats(’sort_column=name&amp;optioncount=1&amp;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

  1. .
  2. <div id=”sidebar”>
  3. <ul>
  4. <li>
  5. .
  6. <?phpwp_list_pages(’sort_column=menu_order&amp;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&amp;optioncount=1&amp;hierarchical=0′); ?>
  18. </ul>
  19. </li>
  20. .
  21. </li>
  22. </ul>
  23. </div> <!– close sidebar –>
  24. .

From: Cpherhackz.net

Next, Part 6 – Footer

Related Post :

Part 1 – Make your Own WordPress Theme

Part 2 – Header
Part 3 – Index
Part 4 – Comment
Part 5 – Sidebar
Part 6 – Footer
Part 7 – Finish!

Written by maketemplates

February 23, 2009 at 9:22 am

Leave a Reply