The Loop and Pagination
-
I copied some code to pull regular post from who knows where a while ago and now I can’t get (1) get it to work with the simple loop and (2) I can’t get it to paginate. I am wondering what is the difference from this
$args = array('posts_per_page' => 3 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();
and this
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?>
For some reason when I use the 2nd code, it only displays the title of the page. And for some reason I am having difficulty understanding where to place the pagination code.
I am just looking to add pagination to my page.
The page is https://www.grayareabrand.com/blog/
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘The Loop and Pagination’ is closed to new replies.