I want to show a post with post title and post content of 400/550 words with a read more link in my category page. I have already done this, but problem is, my post doesn't display the excerpt as it should.

This in my code below.

<?php while ( have_posts() ) : the_post(); ?>
<div class="news">
<div class="grid-container">

  <h2><a href="<?php the_permalink(); ?>" >
    <?php the_title(); ?>
    </a><span class="line"></span></h2>

  <?php  the_post_thumbnail() ?>
  <div class="newsevent"><?php echo substr(get_the_excerpt(), 0,400); ?></div>
  <a href="<?php the_permalink(); ?>" class="readmore">View</a> </div>
<?php endwhile; 


I suspect I need to change <?php echo substr(get_the_excerpt(), 0,400); ?>


1 Answer 1


1) Follow this post on Stackoverflow or the link given by @PieterGoosen.

2) You can also use get_the_content() instead of get_the_excerpt()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.