timeout or blank page on page_archive.php when using get_posts with 2000 posts
-
I have created a page_archive.php template which will list all the posts and pages on my blog. It used to work fine, but I recently passed 2000 posts, and now the page is just blank. I think maybe it is timing out?
I can get the page to display properly if I limit the number of posts displayed to 1900 or less.
Is there something I can do to get all the posts to display on my archive page?
Here is the relevant code:
<?php $posts = get_posts( 'orderby=post_date&order=desc&numberposts=-1' ); ?> <ul> <?php foreach( $posts as $post ) { ?> <?php $title = '' == get_the_title( $post->ID ) ? get_the_time( get_option( 'date_format' ), $post->ID ) : get_the_title( $post->ID ); ?> <li style="padding-bottom: 0"><span class="the_date"><?php echo get_the_time( get_option( 'date_format' ), $post->ID ); ?></span> — <span class="the_title"><a href="<?php echo get_permalink( $post->ID ); ?>"><?php echo $title; ?></a></span></li> <?php } // end foreach ?> </ul>
The topic ‘timeout or blank page on page_archive.php when using get_posts with 2000 posts’ is closed to new replies.