Support » Themes and Templates » Closing div tags in Main Index Template

  • Resolved skirkster


    I noticed that I’m missing closing div tags for classes “content” and “contentLayout” in my Main Index Template. Do these need to be closed within this file or is it possible to close them in others? (here’s the code)

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    </div><!-- end id="content" -->
    <div class="content">
    <div class="Block">
      <div class="Block-body">
    <div class="BlockContent">
      <div class="BlockContent-body">
      <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
          <div class="post" id="post-<?php the_ID(); ?>">
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
            <div class="entry">
              <?php the_content('Read the rest of this entry &raquo;'); ?>
            </div><!-- end id="entryMIT" -->
            <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
          </div><!-- end id="postMIT" -->
        <?php endwhile; ?>
        <div class="navigation">
          <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
          <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
        </div><!-- end id="navigationMIT" -->
      <?php else : ?>
        <h2 class="center">Not Found</h2>
        <p class="center">Sorry, but you are looking for something that isn't here.</p>
      <?php endif; ?>
      </div><!-- end id="BlockContent-bodyMIT" -->
    <div class="sidebar2">
    					<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
    </div><!-- end id="sidebar2MIT" -->
    </div><!-- end id="BlockContentMIT" -->
      </div><!-- end id="Block-bodyMIT" -->
    </div><!-- end id="BlockMIT" -->
    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can close them in others. Its generally a good idea to close Content within the same file – this goes back to what I said about not having the sidebar in the footer section. Typically there will be some DIV’s declared in the header that will not be closed until the footer

    Yeah, I deleted the sidebar 2 from my footer and that got rid of it in the search/archives problem, but now I can’t figure out where to put my sidebar 2 in my regular files. The above code just puts it underneath the last post. It’s almost as if it had to be in the wrong place to work right.


    You need to have the sidebar AFTER the contents div has been closed

    Otherwise it is going to display in the contents area, not to the right of the contents area.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Closing div tags in Main Index Template’ is closed to new replies.