WordPress.org

Support

Support » How-To and Troubleshooting » Pagination woes – Hide pagination if no more posts

Pagination woes – Hide pagination if no more posts

  • Hi

    I’m having pagination woes.
    I’m using next_posts_link and have a custom ajax script running fetching the new posts.

    The ajax works fine – except that the next_posts_link shows even if there are no more posts.

    The jquery does have this:

    if (nextlink != undefined) {
        	jQuery('#pagination a').attr('href', nextlink);
    } else {
          	jQuery('#pagination').remove();
    }

    But it doesn’t seem to do anything.

    Any ideas?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • It seems the trouble is with the next_posts_link itself.
    Currently I have it as:

    <?php next_posts_link('Load More', 1000); ?>

    If I remove the 1000 it doesn’t show at all. If I change it to another number ie 2…it will only show it on the first page. But 1000 seems to define the next links…rather than defining UP TO A 1000 it says it IS A 1000.

    I need it to only use the amount of pages it will need. If that makes sense.

    Any ideas would be greatly appreciated.

    Ok…Feel a bit silly now. I had this same problem about 9 months ago it seems…forgot about it…

    link

    And the last fix on that page…worked for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination woes – Hide pagination if no more posts’ is closed to new replies.