ThemeShaper Forums » Thematic

[closed]

one of my custom page templates changes the location of the container div

(5 posts)
  • Started 11 years ago by melanieg
  • Latest reply from flick
  • This topic is not resolved
  1. I've run into a very strange problem. I have some custom page templates which display posts from only specific categories and one of these page templates puts the closing container div BELOW the footer.

    So, instead of:

    <div id="container">
    <div id="content">
    Whatever the content happens to be...
    </div><!-- #content -->
    </div><!-- #container -->
    <div id="footer">
    </div><!-- #footer -->

    This one rogue page template is outputting:

    <div id="container">
    <div id="content">
    Whatever the content happens to be...
    </div><!-- #content -->
    <div id="footer">
    </div><!-- #footer -->
    </div><!-- #container -->

    The page templates are identical except one is for category 103 and the other is for category 107. And I've checked for any random closing div tags in the posts.

    Has anyone run into this before? It's really messing up my design on that page!

    Thanks in advance for any help!

    Posted 11 years ago #
  2. Here's some more info: this problem occurs only when I have more than 1 post on the page. And at the time I wrote the previous post, I only have 1 post on the page for category 103 and 2 on the page for 107.

    Here's my page template code (let me know if see any red flags)

    <?php

    /*
    Template Name: About Us
    */

    ?>

    <?php get_header() ?>

    <div id="container">
    <div id="content-aboutus">

    <h1 class="entry-title"><?php the_title(); ?></h1>
    <div class="entry-content">
    <?php the_content() ?><!-- the content entered for the page "In the News" -->

    <?php edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>

    </div><!-- .entry-content -->

    <?php query_posts('cat=107'); ?>

    <?php while (have_posts()) : the_post(); ?>

    <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class() ?>">
    <div class="entry-content">
    <?php the_content() ?><!-- all posts in category 107 -->

    <?php edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>

    <?php endwhile;?>

    </div><!-- .entry-content -->
    </div><!-- .post -->

    <?php if ( get_post_custom_values('comments') ) thematic_comments_template() // Add a key+value of "comments" to enable comments on this page ?>

    <?php get_sidebar('page-bottom') ?>

    </div><!-- #content-aboutus -->
    </div><!-- #container -->

    <?php get_footer() ?>

    Posted 11 years ago #
  3. Fixed it! I moved <?php endwhile;?> to below the closing div for #post.

    Changed:

    <?php query_posts('cat=107'); ?>

    <?php while (have_posts()) : the_post(); ?>

    <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class() ?>">
    <div class="entry-content">
    <?php the_content() ?><!-- all posts in category 107 -->

    <?php edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>

    <?php endwhile;?>

    </div><!-- .entry-content -->
    </div><!-- .post -->

    To:

    <?php query_posts('cat=107'); ?>

    <?php while (have_posts()) : the_post(); ?>

    <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class() ?>">
    <div class="entry-content">
    <?php the_content() ?><!-- all posts in category 107 -->

    <?php edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>

    </div><!-- .entry-content -->
    </div><!-- .post -->

    <?php endwhile;?>

    Posted 11 years ago #
  4. Jamie Mitchell
    Member

    well there you go.

    handy piece of code, thanks for posting.

    JM

    Posted 11 years ago #
  5. Thanks for sharing the solution!

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.