How to Show Next-Previous Link Only

I can not figure out how to keep Next and Previous links only and remove page number links. I also tried using this:

previous_post_link();
next_post_link();

But it's not working.

While using the following page templates to display all comments on the website:


?php
/*
Template Name: Display All Comments
Template Post Type: page
Author: www.theidioms.com
*/
?

?php get_header(); ?
div class=blocks main-block
div class=article
h1 id=title class=page-heading?php the_title(); ?/h1

?php 

/*Set how many comments per page*/
$comments_per_page=4;

/*Count comments and count only approved*/
$all_comments = wp_count_comments();
/*If you are going to get only comments from a post you need to change the above code to
$all_comments = wp_count_comments($post-ID);
*/
$all_comments_approved = $all_comments-approved;

/*Get Current Page Var*/
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
/*How many comments offset*/
$offset = (($paged-1) * $comments_per_page) ;
/*Max number of pages*/
$max_num_pages = ceil( $all_comments_approved / $comments_per_page );

/*Get Comments*/
/*If you are going to get comments from a post you need to add 'post_id' = $post-ID, to the array*/
$comments = get_comments(array(
'status' = 'approve',
'number' = $comments_per_page,
'offset' = $offset
));

/*Show Comments*/
if ( $comments ) {
foreach ( $comments as $comment ) {
echo 'pstrong/strong/p';
echo 'pspan class=auth' . get_comment_author( $comment ) . '/span span class=time' . get_comment_date('F j, Y',  $comment ) . '/span/p';
echo 'p class=kni' . $comment-comment_content . ' a class=rm href=' . esc_url( get_comment_link( $comment ) ) . 'Read full  #10170;/a a class=cit href=' . esc_url( get_comment_link( $comment ) ) . '' . get_the_title( $comment-comment_post_ID ) . '/a/p';
}
} else {
// echo 'No comments found.';
}

/*Set current page for pagination*/
$current_page = max(1, get_query_var('paged'));
/*Echo paginate links*/
echo paginate_links(array(
'base' = get_pagenum_link(1) . '%_%',
'current' = $current_page,
'total' = $max_num_pages,
'show_all' = false,
'prev_next' = true,
'prev_text' = __('laquo; Previous'),
'next_text' = __('Next raquo;'),
'end_size' = 0,
'mid-size' = 0,
'type' = 'list'
));


?

/div
/div
?php get_sidebar( 'left' ); ?
?php get_sidebar( 'right' ); ?
?php get_footer(); ?

Topic paginate-comments-links paginate-links pagination Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.