Article in detail

Organizing your theme folder

Written on 31 .Oct. 2007 and has No Opinions

Hello, its wednesday again.. Happy Halloween.! Today, I shall be giving out a tip on how to organize your theme folder, in wordpress so as to get a grip on what you are doing. This is not so much wordpress, as more of a best practice..

Don’t insert your entire code into your sidebar.php, header.php, home.php, page.php, single.php pages… Instead work with chunks.. What do I mean? I shall demonstrate by example.. If you look into my header.php file in my theme folder for chilligavva.com, here’s what you can see after the <body> tag..

This is a slimmer method, and allows me to see what I am doing.. The slicing does not affect the page generation, but is more of a behind the scenes way of allowing you to break down your theme into manageable chunks.. For instance, the baby blocks i am working with is “inc_geoscript.php” and “inc_aboutblog.php”. Note the way I included the file(s). Its preceded by a TEMPLATEPATH location. This way, you can manage any theme or reuse theme iles without typing out oh so long web addresses.. Neat huh?

Hope this was of some use to you…
Grab the sample here…

<body id="top">
<div class="outerwrap"><div class="ctr">     
<a href="#rsslist" class="rss"></a>
     <?php include (TEMPLATEPATH.‘/inc_searchform.php’); ?>
     <div class="logo"><h1><a href="<?php echo get_settings(‘home’); ?>">Chilligavva</a></h1></div>
     <div class="hdr ">
          <? include (TEMPLATEPATH.‘/inc_heading.php’); ?>
          <? if (is_home()){?><div class="whereufrom"><?php include (TEMPLATEPATH.‘/inc_geoupscript.php’); ?></div><?}?>
          <!– end header –></div>
          <div class="clear"> </div>
     <? include (TEMPLATEPATH.‘/inc_menu.php’); ?>     
     <div class="clear"> </div>

     <!– begin content –>
<noscript><p class="noscript">OOPS!  Some parts of Chilligavva <em>will not work without JavaScript enabled</em>.Please, <em>enable JavaScript in your browser</em> and reload the page.  <em>It will not harm your system. That’s a promise.</em></p></noscript>
     <? if (is_home()){ ?>    <? include (TEMPLATEPATH.‘/inc_aboutblog.php’); ?>     <? }?>
 

Lakshmi Mareddy is a polyglot from South India and is interested in design, technology, UI and human computing. She also is a history buff and an avid reader. If you like the way she writes, why dont you subscribe to the site feed via RSS or Email? Its absolutely free and helps you stay current. You can contact her via the contact page or write to lak [at] mareddy [dot] com.

Share your thoughts

Note: Your comments may take time to appear, as they are moderated for the first time.. All comments are followed. Your Personal Info will not be shared. Still have concerns? Read the rights and privacy details of Chilligavva..

 
Security Image
 
CommentLuv Enabled

Life is a process. You are a process. The universe is a process.