WordPress.org

Ready to get started?Download WordPress

Forums

How to add pagination (2 posts)

  1. brian914
    Member
    Posted 3 years ago #

    I am trying to add pagination to my blog page. I have the following to loop through my posts and grab 5, but don't really know how to add pagination. I have tried a few things, but pagination doesn't seem to show up. What do I have to do?

    Thank you so much for any help!

    <?php
    	$query = array(
    		'posts_per_page' => '5',
    		'post_type' => 'post'
    	);
    
    	$queryObject = new WP_Query($query);
    
    	if ($queryObject->have_posts()) {
    		while ($queryObject->have_posts()) {
    			$queryObject->the_post();
    
    			echo the_title();
    			echo the_excerpt();
    
    			} // End if statement
    		}
    	}
    	wp_reset_query();  // Restore global post data
    ?>
  2. Samuel B
    moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic