Title: Few issues with Previous Posts
Last modified: August 31, 2016

---

# Few issues with Previous Posts

 *  Resolved [borbs](https://wordpress.org/support/users/borbs/)
 * (@borbs)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/)
 * Hi! 🙂
 * Just got this add-on and, while it works, it’s not working the way it should.
   
   First of all, this is the shortcode I’m using:
 * `[ajax_load_more previous_post="true" previous_post_id="'.get_the_ID().'" post_type
   ="post" transition="none" posts_per_page="1" scroll_distance="500" max_pages="
   0"]`
 * Very well. The first issue: for some reason, it doesn’t load the previous post
   AUTOMATICALLY. I have to click a blank space or a button (if I turn off the CSS)
   for it to load. Why is this happening?
 * The second issue: when it loads, a few elements appear over the original ones.
   For exemple, the post title. It appears over the original one and it’s a mess.
   😛
 * The third issue: I use waypoints.js to call an sticky bar with the post title
   and share links. It loads on the first post, hides at the end of the page, just
   like it should, but when the waypoint is reached in the new post, it does not
   appear aymore. Any ideas? :/
 * Unfortunatelly I cannot provide you a link (it’s on my computer, at first), but
   I can share some screenshots or codes, if necessary. 🙂
 * [https://wordpress.org/plugins/ajax-load-more/](https://wordpress.org/plugins/ajax-load-more/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [borbs](https://wordpress.org/support/users/borbs/)
 * (@borbs)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436247)
 * Just for the record, this is my SINGLE.PHP.
 *     ```
       <?php get_header(); ?>
       <?php require_once (get_template_directory() . '/inc/mobile/Mobile_Detect.php'); $detect = new Mobile_Detect; ?>
   
       <?php while ( have_posts() ) : the_post(); ?>
   
       <?php echo do_shortcode('[ajax_load_more previous_post="true" previous_post_id="'.get_the_ID().'" post_type="post"  transition="none" posts_per_page="1" scroll_distance="500" max_pages="0"]'); ?>
   
       <?php endwhile; ?>
   
       <?php wp_footer(); ?>
   
       </body>
       </html>
       ```
   
 *  Plugin Author [Darren Cooney](https://wordpress.org/support/users/dcooney/)
 * (@dcooney)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436322)
 * Hi borbs,
 * Issue #1
    It could be that your content is floated with CSS and causing the infinite
   scroll to not kick in due to positioning issues. I would really need to see a
   link to be able to help more.
 * For issue #2 and #3 since the posts are being loaded with ajax you need to initiate
   any required javascript, such as waypoints after the content has been loaded.
   
   This is why we have [callback functions](https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/).
   Check out the almComplete callback. [https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/almcomplete/](https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/almcomplete/)
 * Cheers,
 *  Thread Starter [borbs](https://wordpress.org/support/users/borbs/)
 * (@borbs)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436335)
 * Hey Darren,
    Thank you for your response. 🙂
 * This is the first time in 16 years that I have to deal with AJAX, so it’s all
   absolutely new to me.
 * First of all, I just put a test site online, so you can help me with this.
    I
   sent you the URL on your e-mail, and I’m really sorry about this, but I can’t
   make it public yet. :/
 * So, this is Issue #1. 🙂
 * About issue #2, it’s not javascript related… I think.
    The post_title for the
   second post appears over the first one — so, the second post have no title. You
   have to scroll up to the first one to see it all mixed up.
 * Issue #3… Could you help me with this? I call some .js, and I have one called
   effects.js, that have things like this:
 *     ```
       $(document).ready(function(){
         $('#Capa').waypoint(function(direction) {
       	$('#Barra').css('display', 'block');
           if (direction === 'down') {
             $('#Barra').addClass('fadeInDownBig').removeClass('fadeOutUpBig');
           } else if (direction === 'up') {
             $('#Barra').addClass('fadeOutUpBig').removeClass('fadeInDownBig');
           }
         }, { offset: '-100%' });
   
         $('#SigaANDBotoes').waypoint(function(direction) {
       	$('#Barra').css('display', 'block');
           if (direction === 'down') {
             $('#Barra').addClass('fadeOutUpBig').removeClass('fadeInDownBig');
           } else if (direction === 'up') {
             $('#Barra').addClass('fadeInDownBig').removeClass('fadeOutUpBig');
           }
         }, { offset: '100%' });
   
         $('#Redes').waypoint(function(direction) {
           if (direction === 'down') {
             $('#Barra').addClass('fadeOutUpBig').removeClass('fadeInDownBig');
           } else if (direction === 'up') {
             $('#Barra').addClass('fadeInDownBig').removeClass('fadeOutUpBig');
           }
         }, { offset: '88' });
       });
       ```
   
 * This is the function that makes the sticky nav hide and seek and works in the
   first post, but not the ones after. :/
 * So… That’s it. Hope you can help me with all these issues. 🙂
 *  Thread Starter [borbs](https://wordpress.org/support/users/borbs/)
 * (@borbs)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436336)
 * (Just saw that LazyLoadXT is having some issue, BUT this is only happening online.
   We’ll try to fix it, but I don’t think it’s related)
 *  Thread Starter [borbs](https://wordpress.org/support/users/borbs/)
 * (@borbs)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436345)
 * And I don’t even know if this is expected, but when I hit the BACK button, the
   URL is changed, but the post is not…
 *  Thread Starter [borbs](https://wordpress.org/support/users/borbs/)
 * (@borbs)
 * [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436352)
 * Ok, the ISSUE #2 is solved.
    It was a problem with a div that was not relative.
   🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Few issues with Previous Posts’ is closed to new replies.

 * ![](https://ps.w.org/ajax-load-more/assets/icon-256x256.png?rev=2944639)
 * [Ajax Load More – Infinite Scroll, Load More, & Lazy Load](https://wordpress.org/plugins/ajax-load-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-load-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-load-more/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-load-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-load-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-load-more/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [previous post](https://wordpress.org/support/topic-tag/previous-post/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)

 * 6 replies
 * 2 participants
 * Last reply from: [borbs](https://wordpress.org/support/users/borbs/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/few-issues-with-previous-posts/#post-7436352)
 * Status: resolved