Pagination Using ajax

Question

I want to use Pagination using ajax for custom post taxonomy.
Many of codes are tried by me but at the last I was failed. So,how can i use pagination using ajax without plugin?

When i am clicking on load more button then the post will load on the same page.

post name:- project

taxonomy name:- framework

functions.php

 function wp_pagination() {
    global $wp_query;
    $big = 12345678;
    $page_format = paginate_links(array(
        'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
        'format' => '?paged=%#%',
        'current' => max(1, get_query_var('paged')),
        'total' => $wp_query->max_num_pages,
        'type' => 'array'
            ));
    if (is_array($page_format)) {
        $paged = ( get_query_var('paged') == 0 ) ? 1 :
                get_query_var('paged');
        // echo '<div><ul>';
        // echo '<li><span>'. $paged . ' of ' . $wp_query->max_num_pages.'</span></li>';
        echo "<center>";
        foreach ($page_format as $page) {
            echo " " . $page;
        }
        echo "</center>";
        echo '</div>';
    }
}
0
, jayesh 3 years 2020-04-01T04:51:04-05:00 0 Answers 76 views 0

Leave an answer

Browse
Browse