Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-03-30 14:34:03
- Ian Goldby
- Archived Plugin Author
- Registered: 2007-09-16
- Posts: 6
Hide page from article list?
How can I add one or more pages to a section but prevent these pages from appearing in the article list – either for that section or anywhere else?
I also need these special pages to be displayed with a different form to the usual form for that section.
The specific problem here is that I need a ‘Cancel’ page and a ‘Thanks’ page in the ‘shop’ section of a site that I am creating. I think they should be in the shop section because they are part of the shop. But every other page in the shop is a product, and these two special pages must not appear as products – for obvious reasons!
I got half way there by setting the special pages to ‘Hidden’, but then I couldn’t display them at all. When I went to http://mysite.com/shop/Thanks, I got a 404 error.
I also tried making them ‘Sticky’, although this doesn’t sound like the right thing to do because ‘Sticky’ implies something quite different to what I want. Anyway, I got a page, but the text of the article was missing and there was still no obvious way of changing the form used from the normal shop product form.
Offline
Re: Hide page from article list?
To show a hidden article in that section you use the ‘status’ attribute.
<txp:article status="hidden" />
There are ther attributes for <txp:article />
Or show an article by ID:
<txp:article_custom id=12" />
Other attributes for <txp:article_custom />
To prevent articles form appearing in lists you could define categories for those lists <txp:recent_article category="apples,oranges" />
which would exclude categories not listed.
I would use different sections for what you are doing. But Textbook might have some fancy tag combos to do it your way. Or, there might be a Plugin.
txtstrap (Textpattern + Twitter Bootstrap + etc…)
Offline
Offline
#4 2008-04-06 20:18:01
- Ian Goldby
- Archived Plugin Author
- Registered: 2007-09-16
- Posts: 6
Re: Hide page from article list?
What a week! I’m sorry I haven’t been able to respond to this sooner.
Thanks for the suggestions. I’ve learned that status=“hidden” seems to be useful to display a hidden article only on the index page of the section. That’s because Textpattern (as far as I can tell) treats the URL for the hidden page as not existing and gives the 404 error. Makes sense, but not useful for what I want.
Status = sticky seems to hold more promise. The answer is as follows (inspired by This forum post):
<txp:if_individual_article>
<txp:article form="static_article" status="sticky" />
<txp:article form="shop_single" status="live" />
<txp:else />
<txp:article limit="9" form="shop_list" />
</txp:if_individual_article>
If this is called in an individual article context then either:
- The article is sticky so the ‘static_article’ form is used to display it
- The article is live so the ‘shop_single’ form is used
Otherwise for an article list the shop_list form used.
Seems to work for me.
Offline
Pages: 1