WordPress.org

Ready to get started?Download WordPress

Forums

The Loop in Archive.php (1 post)

  1. Dunkkan
    Member
    Posted 5 years ago #

    Hello guys,

    I have this loop in Archive.php :

    <?php
    	query_posts($query_string.'&posts_per_page=8');
    	if (have_posts()) : ?>
    	<?php while (have_posts()) : the_post(); ?>
    
    	// code, stuff, more code
    
    	<?php endwhile; ?>
    
    	<?php else : ?>
    
    	// code, stuff, more code
    
    	<?php endif; ?>

    Inside that loop, I'm assigning to every div containing a post it's post's ID.

    <div id="<?php the_ID(); ?>">
    	//title, content, tags
    	</div>

    Later, I need, again, the same pack of IDs outside the loop.

    My question is : how can I call TWICE for the same loop ?
    Or :
    Can I store anywhere the id's in the first loop, then echo them anywhere else, without needing a second loop ?

    How would you do that ?

    Many thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic