Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-06-16 17:43:35

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Pull in a sticky article at top of category page

I want to dynamically pull in a sticky article at the top of a category page. The following works great on a section page, but does nothing on a category page:

<txp:article status="sticky" limit="1" />

Any ideas for what else to try?

Offline

#2 2009-06-16 17:57:36

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Pull in a sticky article at top of category page

I think if_category will be your friend…

Offline

#3 2009-06-16 18:08:26

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: Pull in a sticky article at top of category page

Hmm, I don’t see how to use txp:if_category to fix this. I can use that to pull in other stuff, but it doesn’t give txp:article the power to check for sticky articles assigned to the current category.

Offline

#4 2009-06-16 18:34:25

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Pull in a sticky article at top of category page

Oh that’s different – what about something like:

<txp:if_category name='<txp:category />'>
<txp:article status="sticky" limit="1" />
 </txp:if_category>

Offline

#5 2009-06-16 18:36:42

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Pull in a sticky article at top of category page

Or:

<txp:if_category>
<txp:article_custom status="sticky" limit="1" category='<txp:category />' />
 </txp:if_category>

Offline

#6 2009-06-16 18:51:54

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: Pull in a sticky article at top of category page

Would be nice if either of those worked, but they don’t for me!

Do they both work for you?

Offline

#7 2009-06-16 19:10:37

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: Pull in a sticky article at top of category page

Oh, I should mention I’m using rss_unlimited_categories. That could well be related.

Offline

#8 2009-06-16 19:54:23

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Pull in a sticky article at top of category page

Never used that plugin so I don’t know. You could try and turn it off and see what happens with my code…

Offline

#9 2009-06-16 19:59:04

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: Pull in a sticky article at top of category page

Thanks so much for your help, Jonathan! You’ve definitely been a big hep in giving me a sense of where things are breaking.

The more I dig into this, the more it looks like this is related to rss_unlimited_categories. Which I need for other stuff .Grumble

Offline

#10 2009-06-16 22:38:00

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Pull in a sticky article at top of category page

Sorry in advance if I didn’t understand well but can’t you just use:

<txp:article_custom status="sticky" category="<txp:category />" section="<txp:section />" limit="1"  />

?

Offline

#11 2009-06-16 22:49:28

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: Pull in a sticky article at top of category page

Redbot, yes, thanks—I’m pretty sure that (and jstubbs’s examples) would work fine if I wasn’t using rss_unlimited_categories.

But with rss_unlimited_categories in play, neither txp:article_custom nor txp:article can make use of a category name (whether via txp:category or a static category name).

As best I can tell, I’ll need to use the rss_unlimited_categories_article_list tag. But the problem there is that it doesn’t seem to have a status attribute or otherwise be able to see sticky articles.

A conundrum indeed.

Last edited by floodfish (2009-06-16 22:50:28)

Offline

#12 2009-06-16 23:03:08

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Pull in a sticky article at top of category page

Oh, ok.
Unfortunately I never used rss_unlimited_categories so I can’t give you advice, sorry.
Anyway I’d have a look at smd_query (if you have a minimal mysql knowledge) which will probably help.

Offline

Board footer

Powered by FluxBB