Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WordPress Pagination Code to Display Page Pagination in Custom Post Type
Hello, Guys.

Today I am going to share the code which helps you to add number type pagination to your custom type blog post listing template page. All you want to do, Create a page called pagination.php in page-templates folder and copy the given code to it. After that call the page using include function to your custom type post listing page in page-template folder.

PHP Code:


    echo paginate_links(array(

       'base' => str_replace$big'%#%'esc_urlget_pagenum_link$big ) ) ),

       'format' => '?paged=%#%',

       'current' => max1$pge ),

       'total' => $total,

       'prev_text'    => __('<i class="fa fa-caret-left"></i>'),

       'next_text'    => __('<i class="fa fa-caret-right"></i>'),

   ) ); ?>

            <?php wp_reset_postdata(); ?>



    jQuery('.paging-navigation a').each(function(){






        if(href[4]=="ar"){new_href= href_or.replace("/page/1","");





You can call the pagination code by using the include in PHP. Like the below example.

PHP Code:

= array(

'post_type' => "college_directory",

'post_status' => "publish",

'orderby' => 'menu_order',

'posts_per_page' => 1,

'paged' => $paged,

'order' => 'ASC'


$my_query = new WP_Query($news_args);

            if (
$my_query->have_posts()) {

                    while (
$my_query->have_posts()) {

$my_query->the_post(); ?>
                    <div class="media">
                        <div class="media-left media-middle">
                                <a href="<?php the_permalink(); ?>">
                                <div><?php   the_post_thumbnail( array(6565))?></div>
                            <div class="media-body">
                                <h4 class="media-heading"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                    <p class="media-p"><?php the_excerpt(); ?></p>

$total $my_query->max_num_pages;

$pge get_query_var('paged');


            } else {

'No institutions to display';



On the above page, you can see that by using include I called the pagination.

If you have any doubts, Just comment.


Forum Jump:

Users browsing this thread: 1 Guest(s)