Separate First Post Loop

I’m trying to use the feature to use two loops on my homepage template. Does anyone know how to stop the first loop after the latest post?

Here is my Code:

<?php

if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h1>

<?php endwhile; endif; ?>

<?php rewind_posts(); ?>

<?php
if ( have_posts() ) :

if ( is_home() && ! is_front_page() ) :
?>
<header>
<h1 class=”page-title screen-reader-text”>
<?php single_post_title(); ?>
</h1>
</header>
<?php
endif;

while ( have_posts() ) :
the_post();

get_template_part( ‘template-parts/content-home’, get_post_type() );

endwhile;

the_posts_navigation();

else :

get_template_part( ‘template-parts/content’, ‘none’ );

endif;
?>

Read more here:: Separate First Post Loop

Leave a Reply

Your email address will not be published. Required fields are marked *