Forums

Infinite-Scroll
[resolved] Infinite Scroll on home page with multiple loops (3 posts)

  1. S3nd41
    Member
    Posted 4 months ago #

    Hello,

    I was wondering if it's possible to implement inifnite scrolling on multiple loops on my blog's main page that would load posts Twitter style, by clicking a link below each section.

    Here's my code:

    <?php
    	global $post;
    	$post_photos = get_posts('post_type=post&numberposts=20&category=421');
    	$post_videos = get_posts('post_type=post&numberposts=20&category=422');
    ?>
    
    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    <div class="floater_top">
    
    <?php if (have_posts()) : ?>
    
    <!-- PHOTO GALLERY START -->
    
    <div id="photogallery"></div>
    <div class="subfloater">
    
    <h1>Photos</h1>
    <h3>Subtitle</a></h3>
    
    				<?php foreach($post_photos as $post) :
    					setup_postdata($post);	?>
    
    <a href="<?php the_permalink(); ?>">
    <div class="photos_big_outside">
    <div class="photos_big_inside" ><?php get_post_image ('w=140&h=210&zc=T&q=95'); ?></div>
    </div><!-- end photos_big_outside -->
    </a>
    
    				<?php endforeach; ?>
    
    <div class="subfloater_footer_txt">
    <h3><a>Press Here to Load More Photos</a></h3>
    </div><!-- end subfloater_footer_txt -->
    </div><!-- end subfloater -->
    
    <!-- PHOTO GALLERY END -->
    
    <!-- VIDEO DEPOT START -->
    
    <div class="subfloater">
    <div id="videodepot"></div>
    <h1>Videos</h1>
    <h3>Subtitle</h3>
    
    				<?php foreach($post_videos as $post) :
    					setup_postdata($post);	?>
    
    <div class="videos"><h1><?php echo get_the_title($ID) ?></h1></div>
    
    				<?php endforeach; ?>
    
    <div class="subfloater_footer_txt">
    <h3><a>Press Here to Load More Videos</a></h3>
    </div><!-- end subfloater_footer_txt -->
    </div><!-- end subfloater -->
    
    <!-- VIDEO DEPOT END -->
    
    </div><!-- end floater_top -->
    
    			<?php else : ?>
    
    			<?php endif; ?>
    
    <?php get_footer(); ?>

    If someone can help me figure out the selectors I'd appreciate it also, I'm not too experienced with that.

    Thanks in advance!

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. beaver6813
    Member
    Posted 4 months ago #

    Hi S3nd41,
    Unfortunately the wordpress plugin doesn't currently support multiple instances of it running though its definitely something I can look at for the future. (The javascript plugin does support it but its quite complicated to implement: https://github.com/paulirish/infinite-scroll)

    Selector wise, you're best out checking out the short guide I just wrote on how to figure them out:
    http://beaver6813.com/2012/01/selectors-in-infinite-scroll/

  3. S3nd41
    Member
    Posted 4 months ago #

    Thanks for your reply.

    I will take a shot at the Jquery version of your script and thanks for the great visual guide, I can't zoom in on the image you have on your main website so that will be helpful!

Reply

You must log in to post.

About this Plugin

About this Topic