How to check if a post has the Excerpt field filled manually
A function to check if the excerpt was automatically generated by wordpress or manually entered in the Excerpt field
Tweet
the_excerpt( ) displays the content filled in the Excerpt field (if filled manually) or else it will display an automatic excerpt which refers to the first 55 words of the post’s content.
To check if the Excerpt was manually filled, wordpress has a function called has_excerpt( ). So, if you dont like WP’s auto-excerpt, you can write a few lines of code like:
1 2 3 4 5 | <?php if ( has_excerpt( ) ) { the_excerpt(); } else { the_content(); } ?> |
Was this post useful? Share on Twitter or Facebook and spread the love.
Related Posts
- Make URLs within posts clickable
- How to remove the WordPress Admin Bar
- Fix “Is its parent directory writable by the server?” error for WordPress Image uploads
Below is a list of possibly similar posts, as suggested by six huge golems hired to do just that.
Now What?
- Tweet this It's been long since you tweeted
- Ask Got a query you want us to answer?
- Spread the love Share it socially
Finished reading? Wondering what to do? Heres a hint. Here are some suggestions just for you