Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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() ?>
  </a>
  <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); ?>

share|improve this question
1  
possible duplicate of Allow html in excerpt –  Pieter Goosen Jun 10 at 12:58
    
Nearly everything you want to know about the excerpt is covered in above link –  Pieter Goosen Jun 10 at 12:59

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()

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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