Posts per Page
-
I’m trying to get the below page template to show all posts from all categories. I tried setting ‘posts to page’ to -1 but no such luck. Am I missing something else?
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $the_query = new WP_Query( array ( 'posts_per_page' => 1, 'category__in' => $categories, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)) ); $i= 2; ?> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); $id = get_the_ID(); ?> <?php if ($i % 2 == 0) { echo '<div class="centered inner"><div class="whole-post">'; } else { echo '<div class="blue-content color-grey"><div class="centered inner"><div class="whole-post">'; } ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div class="post-info">Posted <?php the_time('F jS, Y'); ?><?php /* | Author: <?php the_author(); */?></div> <div class="post-content"><?php the_content(); ?></div> <?php if ($i % 2 == 0) { echo '</div></div>'; } else { echo '</div></div></div>'; } ?> <?php $i++; ?> <?php endwhile; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Posts per Page’ is closed to new replies.