Pagination on custom-single.php does not work (3 posts)

  1. uandersonft
    Posted 3 years ago #

    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(); ?>
    	  <li><?php the_title(); ?></li>
            <?php endwhile; else: ?>
    		  <?php endif; ?>
           <!-- Selection end -->
        <?php if(function_exists('wp_pagenavi')) {wp_pagenavi();}?>
  2. 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.

  3. uandersonft
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic