Forums

Static Page - pulls posts correctly - but displays them twice. (2 posts)

  1. trulyandy
    Member
    Posted 7 months ago #

    • I have created a static Page (News) which I am using to display posts from a certain category (works correctly)
    • The Page uses a simple Template I created (news.php) with the following php code
      <?php while (have_posts()): the_post(); ?>
      <?php the_content();?>
      <?php endwhile;?>
    • The Page's html includes a php include <?php include (TEMPLATEPATH . '/news_updates.php'); ?>
    • news_update.php is what grabs the posts with this code `<?php
      query_posts('cat=20'); ?>`
    • All of this works fine...my Static News page displays only the posts that fall into cat=20.
    • HOWEVER, for some reason, after displaying the posts as specified in the news_updates.php (title, body, time, etc), and closing out the display of that static News Page, below these posts it re-displays only the body from the cat 20 posts.
    • By adding comments into both the news_updates.php include and the news.php template, I have determined it the re-display of the cat20 posts' body is generated from the news.php template

    Any ideas as to WHY this is displaying and how to fix it would be greatly appreciated.

    I guess another way to ask this question is, how, via a Template, do I query the content of a static page (which then correctly queries specific posts via a php include), WITHOUT having the Template query any posts whatsoever.

    here is a link:
    http://www.trulygoodsolutions.com/b11/news/

  2. stvwlf
    Member
    Posted 7 months ago #

    Hi

    In doing a View Source on your page I am seeing some mis-matched Div's. Also, in the middle of the page display is

    </body>
    </html>

    followed by more code. Perhaps that is coming from your include file?
    There is also a

    </body>
    </html>

    at the end in the correct place.

    In other words, there are HTML code errors that are causing this behavior.

    If you have trouble finding them, use the page validator
    http://validator.w3.org/check?uri=http://www.trulygoodsolutions.com/b11/news/
    which will list where its seeing structural errors in your code. It shows 27 errors (that is not very many). Generally fixing at least the structural errors resolves problems such as you are having.

    Start with a View Source - your code is not complex and you should be able to see mismatched div's.

Reply

You must log in to post.

About this Topic