WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] My theme is broken, help! (5 posts)

  1. skirkster
    Member
    Posted 5 years ago #

    Hello all,

    I've been trying to get my theme to function correctly for days now. Everything works fine, except whenever I search for anything, or click my left sidebar links (which are linked to categories), my exterior border doesn't refill around all the content. Also, my right sidebar is called a second time and stretches the width of the page below all the existing content. I've gone over and over my code repeatedly to no avail. You can go to the page at blog.noelmarie.com to see. Try the left sidebar links or try to search, you'll see what I mean. I've tried to validate the page after this error, but I don't know how to fix the errors within all my template files. I did notice that "div class navigation" is on some files twice, and I believe I've narrowed it down to either my Main Index Template, Search, Archives, or Footer. Here is code from those, if it helps. I'm going live with this next Monday and am really starting to panic, so any help would be fantastic!

    Main Index:

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    
    </div>
    <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>
    
            <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>
    
        <?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>
    
      <?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>
    
    </div>
    
      </div>
    
    </div>
    
    <?php get_footer(); ?>

    Search:

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    
    </div>
    <div class="content">
    
    <div class="Block">
      <div class="Block-body">
    
    <div class="BlockHeader">
    Search Results
      <div class="l"></div>
      <div class="r"><div></div></div>
    </div>
    
    <div class="BlockContent">
      <div class="BlockContent-body">
    
    <?php if (have_posts()) : ?>
    	<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>
    	<?php while (have_posts()) : the_post(); ?>
    		<div class="post">
    			<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    			<small><?php the_time('l, F jS, Y') ?></small>
    			<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>
    	<?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>
    <?php else : ?>
    	<h2 class="center">No posts found. Try a different search?</h2>
    <?php endif; ?>
    
      </div>
      <div class="BlockContent-tl"></div>
      <div class="BlockContent-tr"><div></div></div>
      <div class="BlockContent-bl"><div></div></div>
      <div class="BlockContent-br"><div></div></div>
      <div class="BlockContent-tc"><div></div></div>
      <div class="BlockContent-bc"><div></div></div>
      <div class="BlockContent-cl"><div></div></div>
      <div class="BlockContent-cr"><div></div></div>
      <div class="BlockContent-cc"></div>
    </div>
    
      </div>
    </div>
    
    </div>
    
    </div>
    
    <?php get_footer(); ?>

    Archives:

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    
    </div>
    <div class="content">
    
    <div class="Block">
      <div class="Block-body">
    
    <div class="BlockContent">
      <div class="BlockContent-body">
    
    <?php is_tag(); ?>
    <?php if (have_posts()) : ?>
    
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="pagetitle">Author Archive</h2>
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) &amp;&amp; !empty($_GET['paged'])) { ?>
    <h2 class="pagetitle">Blog Archives</h2>
    <?php } ?>
    
    <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>
    
    <?php while (have_posts()) : the_post(); ?>
    <div class="post">
    		<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    		<small><?php the_time('l, F jS, Y') ?></small>
    
    		<div class="entry">
    			<?php the_content() ?>
    		</div>
    
    		<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>
    
    <?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>
    
    <?php else : ?>
    
    <h2 class="center">Not Found</h2>
    
    <?php endif; ?>
    
      </div>
      <div class="BlockContent-tl"></div>
      <div class="BlockContent-tr"><div></div></div>
      <div class="BlockContent-bl"><div></div></div>
      <div class="BlockContent-br"><div></div></div>
      <div class="BlockContent-tc"><div></div></div>
      <div class="BlockContent-bc"><div></div></div>
      <div class="BlockContent-cl"><div></div></div>
      <div class="BlockContent-cr"><div></div></div>
      <div class="BlockContent-cc"></div>
    </div>
    
      </div>
    </div>
    
    </div>
    <div class="sidebar2">
    
    					<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
    
    </div>
    
    </div>
    
    <?php get_footer(); ?>

    Footer:

    </div>
    <div class="sidebar2">
    
    					<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
    
    </div>
    
    </div>
      </div>
      <div class="Sheet-tl"></div>
      <div class="Sheet-tr"><div></div></div>
      <div class="Sheet-bl"><div></div></div>
      <div class="Sheet-br"><div></div></div>
      <div class="Sheet-tc"><div></div></div>
      <div class="Sheet-bc"><div></div></div>
      <div class="Sheet-cl"><div></div></div>
      <div class="Sheet-cr"><div></div></div>
      <div class="Sheet-cc"></div>
    </div>
    
    <div id="footer">
    <!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
    <p>Designed by CVB.<br />
    <a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> and <a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>.
    <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --></p>
    </div>
    </div>
    </div>
    <?php wp_footer(); ?>
    
    </body>
    </html>

    Again, thanks to anyone who can help me!

  2. stvwlf
    Member
    Posted 5 years ago #

    Hi

    Your archives file has a call to sidebar 2 at the bottom of the file.

    And you footer file has a call to sidebar 2 at the top of the file.

    2 calls to sidebar 2...

  3. skirkster
    Member
    Posted 5 years ago #

    Removing it from the footer removes it altogether. Removing it from the archives gives me the same result as before, with 2 right sidebars. Search and Archives do the same thing.

  4. stvwlf
    Member
    Posted 5 years ago #

    typically in WP themes the sidebar call is in the individual content template files, not in the footer files.

    Why it disappears when removed goes back to the same issue of where your div's are closed. You have so many div's its hard to tell what is going on. Ten to one the sidebar in the archive file is in the wrong place, relative to the closing div's.

    It is a really good idea to tag closing div's with a comment that shows what opening div the closing div is associated with

    </div><!-- end id="content" -->

    <div class="BlockContent-tl"></div>
      <div class="BlockContent-tr"><div></div></div>
      <div class="BlockContent-bl"><div></div></div>
      <div class="BlockContent-br"><div></div></div>
      <div class="BlockContent-tc"><div></div></div>
      <div class="BlockContent-bc"><div></div></div>
      <div class="BlockContent-cl"><div></div></div>
      <div class="BlockContent-cr"><div></div></div>
      <div class="BlockContent-cc"></div>

    why do you have 3 closing div's and one opening div on all the middle lines in this code?

  5. skirkster
    Member
    Posted 5 years ago #

    Long story. Anyway, I removed all those unnecessary ones and tagged the closing div's. Here it is, any ideas (this is the version without the sidebar2 code)?

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    
    </div><!-- end id="sidebar1" -->
    <div class="content">
    
    <div class="Block">
      <div class="Block-body">
    
    <div class="BlockContent">
      <div class="BlockContent-body">
    
    <?php is_tag(); ?>
    <?php if (have_posts()) : ?>
    
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="pagetitle">Author Archive</h2>
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) &amp;&amp; !empty($_GET['paged'])) { ?>
    <h2 class="pagetitle">Blog Archives</h2>
    <?php } ?>
    
    <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="navigation" -->
    
    <?php while (have_posts()) : the_post(); ?>
    <div class="post">
    		<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    		<small><?php the_time('l, F jS, Y') ?></small>
    
    		<div class="entry">
    			<?php the_content() ?>
    		</div><!-- end id="entry" -->
    
    		<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="post" -->
    
    <?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="navigation" -->
    
    <?php else : ?>
    
    <h2 class="center">Not Found</h2>
    
    <?php endif; ?>
    
      </div><!-- end id="BlockContent-body" -->
      <div class="BlockContent-tl"></div><
      <div class="BlockContent-tr"></div>
      <div class="BlockContent-bl"></div>
      <div class="BlockContent-br"></div>
      <div class="BlockContent-tc"></div>
      <div class="BlockContent-bc"></div>
      <div class="BlockContent-cl"></div>
      <div class="BlockContent-cr"></div>
      <div class="BlockContent-cc"></div>
    </div><!-- end id="BlockContent" -->
    
      </div><!-- end id="Block-body" -->
    </div><!-- end id="Block" -->
    
    </div><!-- end id="content" -->
    
    </div><!-- end id="contentLayout" -->
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic