Skip to main content

How to show particular category all post in custom single file

Let me tell details about what I am trying to do,

I have one category call Members this category show in custom category file. and in category page show featured images with <?php the_permalink(); ?> so when I click thumbnail image it go to single.php file this is WordPress system for this Members category post I have one custom template also. which define in single.php bellow is code

<?php
get_header(); ?>
<div class="contentarea cf">
  <?php while ( have_posts() ) : the_post(); ?>
  <h3>
    <?php the_title(); ?>
  </h3>
  <?php
    if ( in_category( 'members' ) ) {
         get_template_part( 'content', 'members' );
    } 
     
    else {
        get_template_part( 'content', 'common' );
    }
 ?>
  <?php endwhile;  ?>
</div>
<?php get_footer(); ?>

so when Members post open its go to content-members.php file and show post. but now I want in this page will show all Members post not only one post. I can't figure out yet how to do that.

pagol
  • 203
  • 2
  • 4
  • 18