WordPress Posts Pagination Not Working


I am having problems with the post pagination of this certain category. I have this working 'Previous' and 'Next' using the previous_post_link() and next_post_link(). I have several issues regarding this. I'll just number it so it will be organized.

  1. 'First' - when clicked, it will go to the first post or the newest post in Wordpress and same goes to the 'Last'. I was looking for a PHP call for this.
  2. 2 3 4 5 - pagination numbers in between 'Previous' and 'Next'. I am looking for a PHP call to do this. Is there?
  3. I want to retrieve the current page number of the post and the total number of post. I went through the code of the plugin wp_pagenavi but I am having a hard time with it.

Please see image of what I wanted to achieve, hope someone can give me a link of a tutorial that does that. I am open to plugins.

enter image description here

Thanks in advance for the help, hope I did not confuse any of you of these several problems.



Pagination Like : Prev 1 2 3 Next

<?php 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$news= new WP_Query(array(
    'post_type'=>'post',
    'posts_per_page' => 3,
    'paged' => $paged,
));

if($news->have_posts()) :
    while($news->have_posts())  : $news->the_post();
            the_title();
    endwhile;

    $total_pages = $news->max_num_pages;

    if ($total_pages > 1){

        $current_page = max(1, get_query_var('paged'));

        echo paginate_links(array(
            'base' => get_pagenum_link(1) . '%_%',
            'format' => '/page/%#%',
            'current' => $current_page,
            'total' => $total_pages,
            'prev_text'    => __('« prev'),
            'next_text'    => __('next »'),
        ));
    }
    ?>    
<?php else :?>
<h3><?php _e('404 Error&#58; Not Found', ''); ?></h3>
<?php endif; ?>
<?php wp_reset_postdata();?>

Would you please check above code?


I found the solution for item #1. I stumbled upon this code:

<?php
   $args = array(
     'cat' => 39,
     'posts_per_page' => 1,
     'order' => 'ASC'
);
$my_query = new WP_Query($args);
while ($my_query->have_posts()) {
  $my_query->the_post(); ?>
  <a href='<?php the_permalink(); ?> ' >First Page</a> |
<?php }
wp_reset_query(); ?>
<?php previous_post_link('%link', '<< Previous', TRUE); ?> |
<?php next_post_link('%link', 'Next >>', TRUE); ?>
<?php $args['order'] = 'DESC';
$my_query = new WP_Query($args);
while ($my_query->have_posts()) {
  $my_query->the_post(); ?>
   | <a href='<?php the_permalink(); ?> ' >Last Page</a>
  <?php } ?>

This is the link of the site: http://wordpress.org/support/topic/link-to-most-recent-post-in-one-category