Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-12-17 22:28:41

ATF
New Member
Registered: 2011-12-16
Posts: 6

On displaying only one catagory on default page

Hi all,

I’m new to TP so hope this isn’t something obvious. but I have several sections with articles posted in them. On the default page I just want to show articles that have been put in the category news, these articles could be in the news section or in another section. I want it to show excerpts from 5 news stories at a time.

I thought I’d worked out how to do but I have a problem,
What I have done is set all categories to display on front page, then called the following form:

<txp:if_first_article><ul class=“directory”></txp:if_first_article>
<txp:if_article_category name=“news” >
<li><txp:permlink><txp:title /></txp:permlink>·
<txp:excerpt /><txp:permlink><span class=“read_more”> Read More </span></txp:permlink></li>
</txp:if_article_category>
<txp:if_last_article></ul></txp:if_last_article>

Problem is the the code that calls the forms (<txp:article listform=“default” limit=“5” form=“single”/>) asks for 5 articles but I guess what is then happening is 5 are called and only the news ones are displayed, which means I have <5 articles on each page of news articles.
Is there a way of doing this. Or have a made a fundamental error in my understanding of TP and should do it an entirely different way (I’ve spent all day learning TP and thought I finally had my head round it – but maybe not!)

TIA for any help,

Offline

#2 2011-12-17 22:34:55

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: On displaying only one catagory on default page

Instead of <txp:article /> use <txp:article_custom category="news" /> on your front page.

Last edited by els (2011-12-17 22:35:32)

Offline

#3 2011-12-17 22:41:19

ATF
New Member
Registered: 2011-12-16
Posts: 6

Re: On displaying only one catagory on default page

Sorry I should have said I want to also be able to view older news items than the first 5.

If I use the above it allows it to only show news items, but doesn’t allow the ‘older’ ‘newer’ links, is there a way to make <txp:article_custom category=“news” /> show links to older articles as well?

Offline

#4 2011-12-17 23:46:50

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: On displaying only one catagory on default page

Ah, pagination doesn’t work with article_custom, not out of the box anyway. But people have found ways to do it: 1, 2.

Offline

#5 2011-12-18 09:41:39

ATF
New Member
Registered: 2011-12-16
Posts: 6

Re: On displaying only one catagory on default page

Thanks. worked a charm.
I’m getting seduced by TXP!

Offline

Board footer

Powered by FluxBB