WordPress Pagination

Hey guys,

I was wondering if you could help me out. At the bottom of one of my pages I have a 'next and ‘previous’ link that are currently working. I am trying to implement code that will display pagination and replace the working ‘next’ and ‘previous’ links. Here is the working ‘next’ and ‘previous’ code:


<div class="span6 previous-page">
            <?php if ($current_post_list_page > 1): ?>
            <a id="singlepost-list-previous"
               href="<?php echo add_query_arg('spl_page', $current_post_list_page - 1) ?>">PREVIOUS
                </a>
            <?php else: ?>
            &nbsp;
            <?php endif; ?>
        </div>
        <div class="span6 text-align-right next-page">
            <?php if ($current_post_list_page < $posts_list_query->max_num_pages): ?>
            <a id="singlepost-list-next" href="<?php echo add_query_arg('spl_page', $current_post_list_page + 1) ?>">NEXT
                </a>
            <?php else: ?>
            &nbsp;
            <?php endif; ?>
        </div>

And here is the code that displays the pagination that I want to replace it with:

<?php
//global $wp_query;
//$total = $wp_query->max_num_pages;

$total = $posts_list_query->max_num_pages;

if($total > 1) {
if ( !$current_page = get_query_var('paged') ){$current_page = 1;}
$perm_structure = get_option('permalink_structure');
//$format = empty($perm_structure) ? '&page=%#%' : 'page/%#%/';
$format = empty($perm_structure) ? '&page=%#%' : '?spl_page=%#%';
$paginate_return_data = paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'plain'
));
echo $paginate_return_data;
}
?>

Any help would be much appreciated. Thanks. :slight_smile: