function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
write below code in your template.
<?php echo excerpt(25); ?>
Related Posts:
- Read more tag shows up on EVERY post
- “Read more” link doesn’t show up when the post length is under the excerpt length
- Custom excerpt showing first paragraph (with HTML formatting)
- Different ‘read more’ links
- Read more on the post page itself
- Excerpt using Read More Tag
- How to wrap “Read More” link in a DIV tag?
- Problem with viewing single page correctly. (taken half way down the page on click through)
- Remove ‘read more’ link when post is shorter than excerpt
- Append Second Link to Read More
- “Continue reading” not on some posts, full excerpts not shown
- the_excerpt() is not trimming at
- How to use limit post content on archive page in WordPress?
- Remove Default Read More Link in Manual Excerpt RSS Feed
- multiple excerpt length and styles
- Remove the excerpt and “… Read More” from the featured content on the home page with child theme
- Is there a way to display the ‘Read more’ link if it’s within a range?
- Using wp_trim_excerpt to get the_excerpt() outside the loop
- How can i limit the character length in excerpt? [duplicate]
- How to get the unfiltered excerpt, without […] or auto-excerpting
- Remove “Continue Reading” Link From the Teaser Excerpt Only
- Modify youtube video size on one page and show another size on different page
- Modify ‘Read more’ link adding a new class
- Limit the_excerpt in the first point (.) of the sentence
- Excerpts that don’t truncate words
- Spacing within the excerpt
- Custom Excerpt is returning 52 characters and not 52 words
- the_excerpt Read More Filter
- How to get the excerpts of all children pages
- Empty excerpt using wp_get_recent_posts
- The excerpt: Display text OR image OR video
- Read More for Excerpt not working
- adjust the_excerpt based on template page
- First letter cutting off in excerpt
- Getting the_excerpt to link to child pages [closed]
- How to get the excerpt of a page before more tag?
- Getting first 20 words without excerpt
- Change excerpt length of first post
- Display oEmbed in the_excerpt
- Remove Text within Header tags in the Excerpt
- Line in excerpt and max 5 lines
- Include post title in readmore link?
- How to put “Read more” link in Custom Excerpt inside p tag?
- Exclude read more in the_excerpt [closed]
- How to show post content before read more tag (excerpt) for password protected posts?
- How to apply excerpt length only on front end?
- get_the_excerpt() issues – returns the excerpt twice or not at all?
- Excerpt content
- new_excerpt_more link not working properly
- read more, even if excerpt not trimmed
- Give “Read More” precedence over excerpt() word count
- Show excerpts of posts on P2 Home page
- How to change the length of excerpt() method?
- Removing h3s in excerpt output?
- get_the_excerpt without images
- How to properly show the Excerpt only if it exists?
- The excerpt doesn’t add Read more
- Text with special class as excerpt (or exclude special class)
- Show Excerpts In Twenty Eleven Theme
- How do you edit the html of teaser excerpts
- Add custom read more to the_excerpt and
- Remove [ and ] from excerpt
- Is it possible to use words as starting and ending points of excerpt parameters?
- Split the_content into two parts
- How to replace get_the_excerpt with first N words of post article while stripping html
- How to edit a typo in excerpt?
- My post excerpt does not work
- The excerpt suffix won’t go away
- Adding […] string for a custom excerpt function
- Replace text in excerpt
- How to achieve two different excerpt types on one WordPress site?
- Modify excerpt link
- Reblog WordPress to another WordPress?
- How to enable excerpts just on the “Posts page”
- Cannot figure out how to add a read more link to a manual excerpt. Please help
- Excerpts not showing
- Keep excerpt from stripping URLs and enable autoembed for youtube ONLY?
- Excerpt being limited too early
- Help needed using wp_trim_words
- Read More in the actual excerpt
- get_the_excerpt adding unwanted links to output html
- Excerpt functions is removing the forward slash on the url
- the_excerpt() doesn’t return the Excerpt field content
- How to add a new line to an excerpt?
- Define excerpt length by inserting read more tag
- 2 posts same excerpt?
- Excerpt displays the current page excerpt not one being pulled
- Edit the excerpt before it is shown
- Can’t change excerpt length and more tag
- Is there a html tag filter for the excerpt?
- Add rel=lightbox to custom string
- get_posts displaying wrong permalink for “continue reading” link
- WordPress Post Format If Statement?
- Excerpt Problems
- Function to shorten string without cutting off last word
- How to show excerpt field
- Get a raw value of excerpt
- Need to show post summary in sidebar
- Limited excerpt with readmore
- Can anyone help me with replace genesis post excerpt with yoast meta description and if there is no meta description show the excerpt?