Using The Tag Limit Plug-in with ExpressionEngine

April 22, 2007
Greg Ferrell

Upon redesigning this website, I decided I wanted to do a little more with the front page. The first thing that I wanted to accomplish besides a new look was removing entire posts from the front page and just having short snippets of each post so that there would be less scrolling and a reason to view the entry/comments page.

ExpressionEngine has a built in word limiter function that can be used on template tags that produce words. My immediate problem with using the word limiter is that it would cut off paragraphs without closing the paragraph tag. I also show a lot of code within pre tags and those not being closed screwed up the entire page layout.

In my search for a solution that would always work, I came across the_butcher’s Tag Limit Plug-in for ExpressionEngine. It is a rather brilliant plug-in that lets you wrap a content output with tags that will limit the amount of a certain tag that will be renderd. Like so:

{exp:tag_limit tag="p" class="foo" num="2" offset="2"}

This instance will only show 2 tags with the class “foo” and will start with the third one as the offset is set to two. My only grip so far is that you cannot use autoformatting in your post menu when you make posts. You have to enter all html tags yourself, otherwise the extention renders nothing. My guess is that the extention is run before the tags are automatically placed, but I don’t know for sure. The simple solution was for me to just enter the paragraph and break tags myself when posting, which isn’t a big deal, just a pain in the butt.

All in all, I love the plug-in, and what I was able to accomplish with it on the site. I could have used the summary tag to do what this does, and only showed summaries on the front page and full articles at the link, but I like this idea better. It lets me post a little faster not having to come up with a summary as well as the content