When you are writing article using wordpress, you can add an excerpt content for your post. However, if you do not add, we will introduce you to extract excerpt from post content in this tutorial.
1.Get wordpress post content
get_the_content()
2.Extract excerpt with length limitation
For example, you only want to show 100 words in excerpt at most.
<?php $words = explode(" ",strip_tags(get_the_content())); $content = implode(" ",array_splice($words,0,100)); echo $content; ?>
Then the $content is excerpt.