WordPress.org

Ready to get started?Download WordPress

Forums

how to repair the loop ? (2 posts)

  1. pixeline
    Member
    Posted 5 years ago #

    hi!

    In my template, i'm making several calls to display last 5 posts in each category in my sidebar.
    The problem is that these calls overwrite the main content to be shown, so that the main content always shows the first post, no matter what link i click on. If i remove the sidebar code, it works normal.

    How can i reset the loop ? Here is what i call in my sidebar

    <div>
                <ul>
                    <?php
                    query_posts('cat=1&showposts=5');
    
                    while (have_posts()) :
                    the_post();
                    ?>
             <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
                    </li>
                    <?php
                    endwhile;
                    ?>
                    </ul>
                </div>
  2. MichaelH
    Member
    Posted 5 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic