• I tried to add infinite scroll )https://www.billerickson.net/infinite-scroll-in-wordpress/) in my page but is not working. is there any plugin or script works with this theme?
    https://www.susanflory.com/podcast/

    <?php
    /**
     * Template Name: podcast
     */
    
    get_header();
    ?>
    
    <main id="site-main">
    	<?php
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    $args = array(
      'posts_per_page' => 12,
      'paged' => $paged
    );
    $custom_query = new WP_Query( $args );
    ?>
    
    <?php $episode = get_field('episode'); ?>
    
    	<div class="site-page-content listpodcast">
    		<div class="site-section-wrapper site-section-wrapper-main clearfix">
    			<div class="searchbar">
    			<h1 class="floatleft">Episodes</h1>
    			<div class="floatright"><?php get_search_form(); ?></div>
    			</div>
    			
    			<ul class="lastfive">
    			<?php
    			   while($custom_query->have_posts()) :
    				  $custom_query->the_post();
    			?>
    			
    
               <?php //$backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumb-featured-podcast' );?>
                <li>
    				<div class="box">
    				<a href="<?php the_permalink() ?>">
    				<div style="background:url('<?php echo $backgroundImg[0]; ?>') no-repeat center center; background-size:cover;">
    					<?php the_post_thumbnail('thumb-featured-podcast'); ?>
    					<!--h2 class="episodenumber" >Episode <?php the_field('episode', $episode->ID); ?></h2-->
    				</div>
    				<div class="pd15">
    				
    				<h3><?php echo wp_trim_words( get_the_title(), 12 ); ?></h3>
    				<h4><?php echo wp_trim_words( get_field('episode' ), $num_words = 30, $more = '...' ); ?></h4>
    				<!--p><?php echo excerpt(30); ?></p-->
    				<p><em><?php echo get_the_date() ?></em></p>
    				
    				</div>
    					</a>
    				</div> 
    			</li>
                  <?php endwhile;?>
    
      <?php if (function_exists("pagination")) {
              pagination($custom_query->max_num_pages);
          } ?>
    
    </main><!-- #site-main -->
    	
    <?php get_footer(); ?>

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You can try a few of the plugins listed at https://www.ads-software.com/plugins/search/infinite+scroll/

    Someone else may have further suggestions.

    Unless you are intent on debugging your coding attempt, this isn’t a topic for Developing WP Forum. I’m moving it to Fixing WP because it doesn’t sound like you are. Your topic’s URL remains unchanged. We know Fixing WP is not always a logical place so we cannot expect members to get it on first try, but it’s where requests for plugin suggestions are being placed.

    If you really want to do the debugging, the template code you posted only outputs the first batch of posts. It has little to do with infinite scrolling. It’s a paginated template, which is also flawed and will not work reliably beyond the first page. Ajax in WP can be tricky. The first thing to check for are JS errors in the browser console.

Viewing 1 replies (of 1 total)
  • The topic ‘infinite scroll’ is closed to new replies.