Forums

[resolved] Loop doesn't want to end :( (2 posts)

  1. newkind
    Member
    Posted 3 years ago #

    Hi,

    I've got a loop in my header

    <?php query_posts('category_name=feature&amp;showposts=4&amp;orderby=rand'); ?>
    								<?php while (have_posts()) : the_post(); ?>
    								<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><span><?php the_title(); ?></span></a></li>
    								<?php endwhile;?>

    And i want to create an archive page so in the main content area i'm starting the loop by standard procedure :

    <?php if (have_posts()) : ?>

    And it acts like the loop from the header wasn't closed, because it shows me 4 posts from the Feature category ...

    Any help ?

  2. newkind
    Member
    Posted 3 years ago #

    Solved after reading this : http://brassblogs.com/wordpress/creating-wordpress-themes-query_posts

    and

    <?php $welcome = new WP_Query('pagename=welcome');
    if($welcome->have_posts()) : while($welcome->have_posts()) : $welcome->the_post(); ?>
    your post layout here
    <?php endwhile; endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic