Blog

[php]
// The Query
$paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1;
$query = new WP_Query( array (‘paged’ => $paged, ‘posts_per_page’ => ’10’ ) );

if ( $query->have_posts() ) {
// The Loop
while ( $query->have_posts() ) {
$query->the_post();
echo ‘

‘ . get_the_title() . ‘

‘;
echo ‘

‘ . get_the_content() . ‘

‘;
}

previous_posts_link( ‘← Previous Articles‘ );
next_posts_link( ‘Next Articles →‘, $query->max_num_pages );
} else {
// no posts found
}

/* Restore original Post Data */
wp_reset_postdata();
[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *