Customizing Recent Articles Feb 29, 05:58
Whilst there is a recent articles tag I prefer to use a modified article tag to call my recent articles. The reason being that it allows me to customize how I want my past articles displayed, the recent article tag doesn’t allow for that level of customization.
I’m going to go ahead and assume you’ve at least skimmed Your First Textpattern Theme or have fiddled with Textpattern enough to understand forms.
First things first: set up your article tag. You’ll have to decide how many articles to offset and how many you want displayed at one time. In this case I’m going to go ahead and offset the article tag by two (this is for a blog that displays two articles on the front page at a time), to do this I will be using the following attributes: offset="integer" and limit="integer". This is the article tag I’ll be using:
<ul><txp:article limit="5" form="recent_articles" offset="2" /></ul>
That article tag will display the five most recent articles behind the two on the front page. Now create a form called “recent_articles” and start thinking about how you want your recent articles to display. Do you want an excerpt, will you display them in an unordered list? That sort of thing. In this case I’m going to display them in an unordered list just like my own.
<li><txp:permlink><txp:title/></txp:permlink></li>
It’s as simple as that! Your recent articles will display in an unordered list and the possibilities are endless. Want an excerpt instead? Easy as pie.
<txp:if_article_list>
<h1><txp:permlink><txp:title/></txp:permlink></h1>
<txp:if_excerpt>
<txp:excerpt/>
<p><txp:permlink>Read more...</txp:permlink></p>
<txp:else/>
<txp:body/>
</txp:if_excerpt>
<txp:else/>
<h1><txp:permlink><txp:title/></txp:permlink></h1>
<txp:body/>
</txp:if_article_list>
That, if you don’t remember, is from my Textpattern theme tutorial and there is a more detailed (and crappy) explanation of how it works there.
Comments are closed on this post (and most other older posts). If you'd still like to discuss this then please feel free to drop me a line using the contact form below.
Hi I'm Becky, often referred to as The Knitting Hillbilly and Pussybear, owner of this site and general nuisance. I'm a knitter, serial complainer, known whistle blower and I run the ever popular
I believe textpattern is a similar platform as wordpress, but your site looks great!
#1 Destiny Feb 29, 09:16 Permalink