New Textpattern 4.0 Conditional Tags

I’m finally looking into upgrading Pixel Meadow to Textpattern 4.0, and while looking over the dev weblog, I found information about some new conditional tags that sound pretty neat and should make my life easier (and let me do something I’ve wanted to do for a while).

At the moment, the “Latest Little Thing” and “4 Less Recent” on the homepage are created by abusing the <txp: article_custom /> tag. This creates some problems for search results and category pages amongst other things. With the latest SVN checkout from the 4.0 branch you can now use <txp:if_first_article> ... </txp:if_first_article> in your list form to insert content (a special CSS class for example) if the article is the first item in the article list. Similarly, there is a<txp:if_last_article> ... </txp:if_last_article>, which does pretty much what you’d expect…

Also available is the <txp:if_different> ... </txp:if_different> conditional, which lets you insert (for example) a date heading (like in the default template in MovableType) for a group of posts – something I’ve wanted to do for a while, so look out for it in a (near) future version of Pixel Meadow.

This post has more details examples of how to use all these tags.