Thread Starter
borbs
(@borbs)
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>
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. Check out the almComplete callback.
https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/almcomplete/
Cheers,
Thread Starter
borbs
(@borbs)
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
(@borbs)
(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
(@borbs)
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
(@borbs)
Ok, the ISSUE #2 is solved.
It was a problem with a div that was not relative. π