• I’m using this wp-plugin and 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>" 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. ?>
    
    https://www.ads-software.com/plugins/hide-show-comment/

  • The topic ‘Hide/show-button only displayed in the first post?’ is closed to new replies.