WordPress.org

Ready to get started?Download WordPress

Forums

ajax pagination in posts - working, but not like it should (3 posts)

  1. arthurdent2003
    Member
    Posted 2 years ago #

    Hi!

    I have a single.php where a post shows up, that is seperated in different pages with <!--NEXTPAGE--> I have a pagination like this: <?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink= %'); ?>

    Ok - the post pages show up correctly with prev & next button at the bottom of the post.

    Now I use jquery to load each page in that post with AJAX on click on the page number:

    <script type="text/javascript">
    
     $(document).ready(function(){
    
     jQuery('#prevnext_btns a' ).live('click', function(e){ //check when pagination link is clicked and stop its action.
     e.preventDefault();
    
     var link = jQuery(this).attr('href'); //Get the href attribute
     jQuery('.article_wrapper').fadeIn(50000, function(){ //fade out the content area
    jQuery("#loader").show(); // show the loader animation
     }).load(link + ' .article_wrapper ', function(){ jQuery('.article_wrapper p').fadeIn(0, function(){ //load data from the content area from paginator link page that we just get from the top
    jQuery("#loader").hide(); //hide the loader
     }); });
     });
     });
     </script>

    Also this works perfectly -
    BUT: I can't get the first link or the "prev" button in the pagination to work. E.g.: number 2, 3, 4, 5, next do work - but prev and 1 are not linked.

    So how could I fix this?

    Thank you very much!

    AD

  2. arthurdent2003
    Member
    Posted 2 years ago #

    ...just had the wrong jquery version included...shame on me...;-)

  3. halluzineyt
    Member
    Posted 2 years ago #

    Hello! What files did you use can i have some hints on how to do this to my page?

Topic Closed

This topic has been closed to new replies.

About this Topic