Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-02-07 15:39:05

castanet
Member
From: Oxford
Registered: 2005-03-19
Posts: 97

Restrict articles in search results

Hi

I thought it would easy to restrict the types of articles being returned in a search by using this on the search section template:

<code><txp:article category=“news” /></code>

Alas, no. My search results show articles from all categories. Can I restrict the results to just articles from one category?

Thanks

Offline

#2 2008-02-07 15:40:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Restrict articles in search results

I know that you can restrict results on sections, not categories…


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2008-02-07 17:39:55

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

Re: Restrict articles in search results

A workaround would be to wrap the content of your search_results form in <txp:if_article_category name="news">...</txp:if_article_category>, so it won’t display an article if it’s category is not ‘news’.

Offline

#4 2008-02-08 12:05:52

castanet
Member
From: Oxford
Registered: 2005-03-19
Posts: 97

Re: Restrict articles in search results

Thanks, Els. That seems to have done the trick.

Offline

Board footer

Powered by FluxBB