phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


WordPress - Theme: Making Theme Widget Enabled

Tag: wordpress, theme, widget   Category: Web Design, PHP Application
post: 04 Feb 2008 read: 1,186


WordPress theme step by step tutorial - Part 21: We almost finish our theme. But this not yet complete if us not yet talked about widget. Widget make our sidebar more dynamic. We can add and remove plugin more easy than always write code manually.

Open your "sidebar.php". Add following color code:

wordpress theme widget


<div id="right_part">
  <div class="sidebar_container">
  <ul>
  <? if ( !function_exists ('dynamic_sidebar') || !dynamic_sidebar()) : ?>	  
    <li><h2>Pages</h2></li>
    <? wp_list_pages('title_li=') ?>
   </ul>
  </div>
  <div class="sidebar_container">
  <ul>
    <li><h2>Categories</h2></li>
    <? wp_list_cats() ?>
  </ul>    
  </div>  
  <div class="sidebar_container">
  <ul>
    <li><h2>Archives</h2></li>
    <? wp_get_archives() ?>
   </ul>    
  </div>
  <div class="sidebar_container">
  <ul>
    <li><h2>Links</h2></li>
    <? wp_get_links() ?>
    <? endif; ?>
  </ul>    
  </div>      
</div>

Then, create a file named "functions.php". Add following code:


<?
if ( function_exists('register_sidebars') )
	register_sidebars(1);
?>

Ok, now, login as administrator. And follow this instructions:

wordpress theme widget

The result may look like this:

wordpress theme widget



Series this article:
Wordpress - Theme: Installing and Changing Theme
Wordpress - Theme: Building Your Own Theme
Wordpress - Theme: Writing First Code
Wordpress - Theme: Wordpress Code Style
Wordpress - Theme: Showing the Post Excerpt on the Front Page
Wordpress - Theme: Showing Category Name for Each Post
Wordpress - Theme: Showing a Post with Date and Author
Wordpress - Theme: Planning Theme Design
Wordpress - Theme: Writing Basic Code for Two Column
Wordpress - Theme: Splitting Index Become Some Small Parts
Wordpress - Theme: Uniting Various Small Parts
Wordpress - Theme: Separating Stylesheet From Header
Wordpress - Theme: Designing Simple Header
Wordpress - Theme: Placing Content to Body
Wordpress - Theme: Showing Archives, Categories, Links in Side bar
Wordpress - Theme: Creating Footer
Wordpress - Theme: Modifying Single Post Display
Wordpress - Theme: Showing Comments at Single Post
Wordpress - Theme: Showing Comment Form
WordPress - Theme: Showing Trackback,RSS, and Other Detail at Single Post
WordPress - Theme: Showing Title and Other HTML Header
WordPress - Theme: Making Theme Widget Enabled

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting