• Hi, I’m really enjoying this theme. How can I add lazy loading support to it? Is it already included and I’m just missing it? Thanks in advance. Thanks for the theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @chibwe,

    Glad you like it! There’s no lazy loading built-in, but there are plugins that add lazy loading images. I can’t guarantee that they will be fully compatible with Chaplin, but they should work for the images in the post content, at least.

    — Anders

    Thread Starter chibwe

    (@chibwe)

    Hi @anlino,
    Yes, I noticed that post content is lazy loaded. What files would I have to mod in order to enable lazy loading? I tried modifying the preview template partial with the code below. It worked for images that are initially loaded up on a given page. Doesn’t work for the ones loaded upon scrolling down the page. What could be causing this? Please let me know if You need more info to help clarify things.

    
    if ( $aspect_ratio !== 'original' ) : ?>
    
    	<a href="<?php the_permalink(); ?>">
    		<img class="faux-image dd-rounded-top aspect-ratio-<?php echo $aspect_ratio; ?>" src="<?php echo esc_url( $image_url ); ?>">
    	</a>
    
    <?php else : ?>
    
    	<a href="<?php the_permalink(); ?>">
    		<?php 
    		if ( has_post_thumbnail() && ! post_password_required() ) {
    			the_post_thumbnail( $post->ID, $image_size ); 
    		} else {
    			echo '<img src="' . esc_url( $fallback_image_url ) . '" />';
    		}
    		?>
    	</a>
    
    <?php endif; ?>
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Lazy Loading Support’ is closed to new replies.