Pagination doesn’t works on wordpress page

i made a page for showing posts but the pagination doesn’t appear(1,2,3,etc..)

This is the code:

Read More
<div class="browse-content">
    <div class="container">
        <h2><?php echo wp_count_posts()->publish; ?> Movies Found</h2>
        <section>
            <div class="row">
                <ul>    
                <?php
                    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
                    $args = array(
                      'posts_per_page' => 3,
                      'paged'          => $paged
                    );

                    $the_query = new WP_Query( $args ); 
                ?>
                    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
                        <?php  include '_includes/items/item_2.php';?>
                <?php endwhile; wp_reset_postdata();?>
                </ul>
            </div>
        </section>
        <div class="pagination"><?php novavideo_theme_pagination(); ?></div><!-- .pagination -->
        </div>
    </div>
</div>    

I searched everyhere but i did not found an answer…

Can someone help me?

Related posts

4 comments

  1. function novavideo_theme_pagination($pages = '', $range = 4){  
     $showitems = ($range * 2)+1;  
    
     global $paged;
     if(empty($paged)) $paged = 1;
    
     if($pages == '')
     {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
         if(!$pages)
         {
             $pages = 1;
         }
     }   
    
     if(1 != $pages)
     {
         echo "<div class="pagination"><ul><li><span>Page ".$paged." of ".$pages."</span></li>";
    
         if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<li><a href='".get_pagenum_link(1)."'>&laquo; First</a></li>";
         if($paged > 1 && $showitems < $pages) echo "<li><a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a></li>";
    
         for ($i=1; $i <= $pages; $i++)
         {
             if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
             {
                 echo ($paged == $i)? "<li><span class="current">".$i."</span></li>":"<li><a href='".get_pagenum_link($i)."' class="inactive">".$i."</a></li>";
             }
         }
    
         if ($paged < $pages && $showitems < $pages) echo "<li><a href="".get_pagenum_link($paged + 1)."">Next &rsaquo;</a></li>";  
         if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<li><a href='".get_pagenum_link($pages)."'>Last &raquo;</a></li>";
         echo "</ul></div>n";
     }
    

    }

    This is the code

  2. Add this two lines to your theme’s function.php file and everything will get back to work:

    add_filter(‘redirect_canonical’,’custom_disable_redirect_canonical’);
    
    function custom_disable_redirect_canonical($redirect_url) {if (is_paged() && is_singular()) $redirect_url = false; return $redirect_url; }
    
  3.         <?php
    $args = array( 'posts_per_page' => 20 );
    $the_query = new WP_Query( $args );?>
    <?php if ( $the_query->have_posts() ) : ?>
      <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
        <li>
        <h4><a class="text_aktualnosci" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            <span class="data_dodania_arch"><?php _e('Data dodania: '); ?><strong><?php echo get_the_date(); ?></strong></span>
        </h4>
        </li>
      <?php endwhile; ?><!-- end of the loop -->
      <!-- put pagination functions here -->
    <?php else:  ?>
    <p></p>
    <?php endif; ?>
    

Comments are closed.