I have a static wordpress front page. I want the code that works on my regular blog template to work on the homepage too.
Currently, it only shows one post. The code in the main index.php is this…
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() );
?>
<?php endwhile; ?>
<?php wp_pagenavi(); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
content.php calls this….
<div class="col-md-4">
<?php the_excerpt(); ?>
</div><!-- /col-md-4 -->
This works great while on the blog page. But i can’t get this exact same content on to the static home page. I know I need a different query for homepage but no idea what that is. Any help appreciated!
Your code looks right to me, you can try to reset the loop and query the posts again.
Adding this on top of your code should work. Try it out.