How to break a custom loop into multiple pages?
-
Hello,
I’m using the following code to display links to, well, all posts on a website.
<?php $first = 0; //The first article to be displayed ?> <?php while(have_posts()) : the_post(); ?> <!--Post --> <div class="post"> <h2 class="post-title"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a><span class="arrow"></span></h2> <ul> <?php $myposts = get_posts('numberposts=-1&offset=$first'); foreach($myposts as $post) : ?> <li><?php the_time('d/m/y') ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <?php endwhile; ?>
…and it’s a good idea on websites that don’t have 2000+ articles, which doesn’t apply to mine. I was wondering what I should add to this loop in order to break it into pages (say, 50-100 items per page) and, in general, if there’s a way to override the number of shown posts for other types of archives as well.
Thank you. ??
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to break a custom loop into multiple pages?’ is closed to new replies.