Category pagination not working in category.php please help me

Category pagination not working in category.php please help me

Pagination is not working due to the fact that page executes the same queries every time.

From your OP code, it seems that you want to style 1st post differently than other.

If I understood your question correctly, you don’t need to use custom queries, use the one created by WordPress — the main query instead.

This may help.

  <?php 

  global $wp_query;

  if( have_posts() ){

        while( have_posts() ){

              the_post();

              if ( $wp_query->current_post == 0 ){  // Check if it is 1st post


                 // Markup for 1st post


              } 

              else {


                  // Markup for all other posts


              }   // End else

        }// End: while(have_posts())

  }   //End: if(have_posts()) 

 ?>

        <div class="text-center paddingBottom20">
                <div class="pagination pagination-sm">
                    <?php the_posts_pagination( array(
                            'screen_reader_text' => ' ', // this should hide the title
                            'prev_text'          => __( '&larr; পূর্ববর্তী', 'ourdesh' ),
                            'next_text'          => __( 'পরবর্তী &rarr;', 'ourdesh' ),
                            'before_page_number'=> '<b>',
                            'after_page_number'=> '</b>',
                            'show_all'=> false,

                            ) );
                    ?>
                </div>
        </div>