Pagination woes - Hide pagination if no more posts (3 posts)

  1. dyrk
    Posted 5 years ago #


    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 {

    But it doesn't seem to do anything.

    Any ideas?

    Thanks in advance

  2. dyrk
    Posted 5 years ago #

    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.

  3. dyrk
    Posted 5 years ago #

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


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

Topic Closed

This topic has been closed to new replies.

About this Topic