If you treat WordPress exclusively as a blogging application or, even in a more liberal sense, a content management system, then you’re likely used to using the editor or the excerpt field to write a teaser then introduce a Read More link.
WordPress for Web Applications (Again)
For those who have read this site for a while, I’m specifically interested in using WordPress as a foundation for web application development (see also this, this, this, and this).

At the time of this post, this is an article that’s about six years old.
So there are times when the content that you’re going to be rendering on the front-end may be coming from a third-party source.
Back to the Content
That is, the application works like this:
- contact a third-party API,
- import data from the call and parse it as necessary,
- write it to the database,
- render the information on the front-end when requested.
There’s a lot that can go in between each of the above steps, but the main thing I want to share in this post is an effective way to easily truncate text using PHP to render on the front-end.
This is useful for providing teasers, linking out to third-party sites, and more all without needing to write or edit content manually.






