Loop through all posts in a blog feed
-
I’m using a wp-plugin called Hide show comment to be able to hide and show comment sections for posts. The problem I’m having is that the first post in my blog feed (see page here) is the only one that is able to show/hide the comment-section for. The rest of the posts on the page doesn’t get the plugin attatched to it’s comment-sections (div class=”comments”). How can i make every post get this show/hide-link in its comments-section, without the loop ending after the first post?
This is the code for the blog feed:
<main id="main" class="site-main" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php $myposts = get_posts(''); foreach($myposts as $post) : setup_postdata($post); ?> <div class="post-item"> <div class="post-info"> <h1 class="entry-title"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"> <?php the_title(); ?> </a> </h1> <?php catchadaptive_entry_meta(); ?> <div class="category-meta"> <?php catchadaptive_tag_category(); ?> </div> </div> <div class="post-content"> <?php the_content(); ?> </div> </div> <?php comments_template(); ?> <?php endforeach; wp_reset_postdata(); ?> <?php wp_reset_query(); ?> <?php endwhile; // end of the loop. ?> </main><!-- #main --> <?php get_footer(); ?>
- The topic ‘Loop through all posts in a blog feed’ is closed to new replies.