WordPress Pagination

<?php
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 2, ‘order’ => ‘DESC’,’paged’ => $paged, );
query_posts($args);
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post );
$blogimageUrl = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>

 

<?php endforeach;?>

<?php $big = 999999999;
echo paginate_links( array(
‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
‘format’ => ‘?paged=%#%’,
‘current’ => max( 1, get_query_var(‘paged’) ),
‘prev_text’ => __(‘<i class=”fa fa-long-arrow-left”></i>Previous Page’),
‘next_text’ => __(‘Next Page <i class=”fa fa-long-arrow-right”></i>’),
‘total’ => $wp_query->max_num_pages
) );
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s