1
votes

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!

2

2 Answers

0
votes

Your code looks right to me, you can try to reset the loop and query the posts again.

<?php
    rewind_posts(); 
    query_posts( $args );
    while ( have_posts() ) : the_post();
?>

    <!-- Do stuff... -->

<?php endwhile; ?>
-1
votes
global $query_string;
query_posts($query_string.'&post_type=post&posts_per_page=15');

Adding this on top of your code should work. Try it out.