Support » Fixing WordPress » Pagination on custom-single.php does not work

  • Hello everyone, I’m here again, needing your help

    I have a page “Custom-single.php” I use it to open the downloads page and view the downloads of a certain category, it shows everything right, but if it reaches the limit of 5 posting it creates pagination but it does not work when I click to move it back to the home page

    someone could tell me why it does not work? is because it is a custom-single.php?

    the code I’m using:

    <?php query_posts($cat)?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
          <ul>
    	  <li><?php the_title(); ?></li>
    	  </ul>
            <?php endwhile; else: ?>
    		  <?php endif; ?>
    
           <!-- Selection end -->
    
        <?php if(function_exists('wp_pagenavi')) {wp_pagenavi();}?>
       </div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Chris Olbekson

    (@c3mdigital)

    Level 12 Bug Squasher & Forum Moderator

    The problem is that query_posts() is an internal WordPress function that was never meant to be used in templates to call a secondary query or additional loop. For secondary queries use the WP_Query API The linked codex article contains the pagination arguments to add to your query.

    This tutorial on how to use wp_pagnavi with custom queries will be helpful.

    I did, but gives the same error that was, when you click to go to the next page it back to the home page.

    I do not know how I can solve this problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination on custom-single.php does not work’ is closed to new replies.