Loop only displaying one post.
-
Hi,
I’ve got the following code and it’s only displaying the latest post, any idea why it’s only showing one post? It used to work but something changed and now it’s broken. I’m thinking maybe an update to the latest version of WordPress and now it’s using some depreciated code.
Cheers
<?php get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main row" role="main"> <?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=6&post_type=post'.'&paged='.$paged); while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class('col-sm-6'); ?>> <div class="entry-content"> <?php echo '<div class="ashi-content">'; ?> <a href="<?php the_permalink(); ?>"> <?php echo '<div class="ashi-imagehead">'; if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail( 'large' ); } echo '</div>'; echo '<h2>'; the_title(); echo '</h2>'; echo '</a>'; echo '<p class="ashi-date">'; the_time('F j, Y'); echo '</p>'; echo '<div class="ashi-excerpt">'; the_excerpt(); echo '</div>'; echo '<div class="ashi tags">'; the_tags(); echo '</div>'; echo '</div>'; ?> </article><!-- #post-## --> <?php endwhile; // end of the loop. ?> <div class="paged-nav"> <div class="prev"><?php previous_posts_link('« Back') ?></div> <div class="next"><?php next_posts_link('Next »') ?></div> </div> <?php $wp_query = null; $wp_query = $temp; // Reset ?> </div> </main> <!-- #main --> </div> <!-- #primary --> <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Loop only displaying one post.’ is closed to new replies.