wordpress list of posts

I have found this code:

<?php
$myposts = get_posts('');
foreach($myposts as $post) :
setup_postdata($post);
?>
  <div class="post-item">
<div class="post-info">
  <h2 class="post-title">
  <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
  <?php the_title(); ?>
  </a>
  </h2>
  <p class="post-meta">Posted by <?php the_author(); ?></p>
</div>
<div class="post-content">
<?php the_content(); ?>
</div>
  </div>
<?php comments_template(); ?>
<?php endforeach; wp_reset_postdata(); 
?>

Is it good way to display posts? Because it shows, but if I click some post, it shows again all posts but with comments..Is it possible to show only that topic which I have clicked?

Read More

(or if you have some better code to show posts, please write it here)

Related posts

Leave a Reply