Dissection of a WordPress theme: Part 1

Apr 12, 2005 | Tags: , , , | Written by Administrator

After sidebar change

Lets take a look at our site with the new style:

Website

Its getting there, but the sidebar is on the right of the footer and not the content.

Layout

We need to re-arrange the basic structure and move the PHP function call that displays the sidebar to before the code for the posts (so it is to the right of the posts and not the right of the footer).

Edit index.php and move get_sidebar () on line 43 to line 3:

  1. <?php get_header(); ?>
  2.  
  3. <?php get_sidebar(); ?>
  4.  
  5.     <div id="content" class="narrowcolumn">
  6.  
  7.     <?php if (have_posts()) : ?>
  8.  
  9.         <?php while (have_posts()) : the_post(); ?>
  10.  
  11.             <div class="post">
  12.                 <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
  13.                 <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
  14.  
  15.                 <div class="entry">
  16.                     <?php the_content('Read the rest of this entry &raquo;'); ?>
  17.                 </div>
  18.  
  19.                 <p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
  20.  
  21.                 <!--
  22.                 <?php trackback_rdf(); ?>
  23.                 -->
  24.             </div>
  25.  
  26.         <?php endwhile; ?>
  27.  
  28.         <div class="navigation">
  29.             <div class="alignleft"><?php posts_nav_link('','','&laquo; Previous Entries') ?></div>
  30.             <div class="alignright"><?php posts_nav_link('','Next Entries &raquo;','') ?></div>
  31.         </div>
  32.  
  33.     <?php else : ?>
  34.  
  35.         <h2 class="center">Not Found</h2>
  36.         <p class="center"><?php _e("Sorry, but you are looking for something that isn't here."); ?></p>
  37.         <?php include (TEMPLATEPATH . "/searchform.php"); ?>
  38.  
  39.     <?php endif; ?>
  40.  
  41.     </div>
  42.  
  43. <?php get_sidebar (); ?>
  44.  
  45. <?php get_footer(); ?>

Help me to save time by reading these instructions!

If you are asking a question please read the FAQ to see if it has already been answered. All support questions should be directed to the support forum. Thanks!

Share This

Comments

Comments are shown on the first page.

Home | Software | Terms & Conditions | Sitemap | John Godley © 2008
Close
E-mail It