Get a free trial // Grow your CSS skills // Land your dream job

Output Excerpt Manually

Last updated on:

There is always the_excerpt(), but that does some pretty specific stuff (e.g. adding paragraph tags, adding [...], not respect the more comment, use the saved excerpt...). Advanced Excerpt is pretty good at customizing that.

If you want to get real simple though:

  $content = get_the_content(); 
  echo substr(strip_tags($content), 0, 130) . '...'; 


  1. Newton
    Permalink to comment#

    Change the … to


    and you’ve got an even better snippet. 3 dots (periods) is not the same thing as ellipses.

  2. Hassan
    Permalink to comment#

    Instead of substr which may not work in some languages use wp_trim_words function instead.

Leave a Comment

Posting Code

We highly encourage you to post problematic HTML/CSS/JavaScript over on CodePen and include the link in your post. It's much easier to see, understand, and help with when you do that.

Markdown is supported, so you can write inline code like `<div>this</div>` or multiline blocks of code in in triple backtick fences like this:

  function example() {
    element.innerHTML = "<div>code</div>";

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed