0

How can I change this pagination: pagination with numbers

to look like this:

next and back button

Please help me, my page code is:

if($max_page > 1 || intval($pagenavi_options['always_show']) == 1) {
    $pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);
    $pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);

    echo '<div class="page-nav td-pb-padding-side">';   
    previous_posts_link($pagenavi_options['prev_text']);
    if ($start_page >= 2 && $pages_to_show < $max_page) {
        $first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']);
        echo '<a href="'.esc_url(get_pagenum_link()).'" class="first" title="'.$first_page_text.'">'.$first_page_text.'</a>';
        if(!empty($pagenavi_options['dotleft_text']) && ($start_page > 2)) {
            echo '<span class="extend">'.$pagenavi_options['dotleft_text'].'</span>';
        }
    }
    /*
    if($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) {
        for($i = $larger_start_page_start; $i < $larger_start_page_end; $i+=$larger_page_multiple) {
            $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
            echo '<a href="'.esc_url(get_pagenum_link($i)).'" class="page" title="'.$page_text.'">'.$page_text.'</a>';
        }
        echo '<span class="extend">'.$pagenavi_options['dotleft_text'].'</span>';
    }*/

    for($i = $start_page; $i  <= $end_page; $i++) {
        if($i == $paged) {
            $current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']);
            echo '<span class="current">'.$current_page_text.'</span>';
        } else {
            $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
            echo '<a href="'.esc_url(get_pagenum_link($i)).'" class="page" title="'.$page_text.'">'.$page_text.'</a>';
        }
    }

    /*
    if($larger_page_to_show > 0 && $larger_end_page_start < $max_page) {
        echo '<span class="extend">'.$pagenavi_options['dotright_text'].'</span>';
       for($i = $larger_end_page_start; $i <= $larger_end_page_end; $i+=$larger_page_multiple) {
           $page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
           echo '<a href="'.esc_url(get_pagenum_link($i)).'" class="page" title="'.$page_text.'">'.$page_text.'</a>';
       }
    }*/
    if ($end_page < $max_page) {
        if(!empty($pagenavi_options['dotright_text']) && ($end_page + 1 < $max_page)) {
            echo '<span class="extend">'.$pagenavi_options['dotright_text'].'</span>';
        }

        $last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['last_text']);
        echo '<a href="'.esc_url(get_pagenum_link($max_page)).'" class="last" title="'.$last_page_text.'">'.$last_page_text.'</a>';
    }
    next_posts_link($pagenavi_options['next_text'], $max_page);
    if(!empty($pages_text)) {
        echo '<span class="pages">'.$pages_text.'</span>';
    }
    echo '</div>';

}
2
the_posts_pagination(array(
        prev_text => 'PREV',
        next_text => 'NEXT',
        screen_reader_text => ' ' 
        ));

For pagination You should try this. Hope this will help you.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.