Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
crazy custom article_custom list
Here’s what I’d like to do for my homepage: pull together a motley crew of articles with different criteria (say, one future article from section X, three past articles from section Y, any article with a given custom field entry, plus maybe a couple of articles by specific ID) and then sort them according to a separate criteria (possibly another custom field entry).
Any plugin able to do that?
Yes, I have tried turning it off and on.
Offline
Re: crazy custom article_custom list
smd_query
Offline
Offline
Re: crazy custom article_custom list
Yah, I for sure want to mix output from multiple article_custom tags. Both these are way more powerful (not to mention terrifying) than what I need, but I’ll take a closer look and see if I can rig up what I need.
On the output side, is there a way to easily funnel the output into, say, an article form?
Last edited by alesh (2013-08-12 20:19:30)
Yes, I have tried turning it off and on.
Offline
Re: crazy custom article_custom list
You can achieve it without any plugins using variables
<txp:variable name="futureX" value='<txp:article_custom time="future" section="section_X" limit="1" break=""><txp:article_id /></txp:article_custom>'/>
<txp:variable name="pastY" value='<txp:article_custom time="past" section="section_Y" limit="3" break=","><txp:article_id /></txp:article_custom>'/>
<txp:variable name="cfarticles" value='<txp:article_custom cf1="givencustomfieldentry" limit="5" break=","><txp:article_id /></txp:article_custom>'/>
<txp:article_custom id='<txp:variable name="futureX"/>,<txp:variable name="pastY"/>,<txp:variable="cfarticles"/>,120,135' sort="custom_2">
<txp:permlink></txp:title></txp:permlink>
</txp:article_custom>
>Edit… corrected some script typos
Last edited by colak (2013-08-13 08:10:44)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: crazy custom article_custom list
colak wrote:
You can achieve it without any plugins using variables
Yeah, nice! This is probably the best thing to do (after a direct db query) if all articles use the same form. You may need to add sort="custom_2"
attribute to some of article_custom
used in variable
s too.
Offline
Re: crazy custom article_custom list
Whoa—that’s amazing! Thanks everybody!!
Yes, I have tried turning it off and on.
Offline
Re: crazy custom article_custom list
Thought I’d share my code, which is totally working here (the section Exhibitions uses Posted and Expiration dates as the start and end dates. Here I’m pulling one future exhibition and up to 10 current exhibitions. I’ve yet to implement the custom field for sorting):
<txp:variable name="exhibitionsX" value='<txp:article_custom time="past" section="visual-arts" break=","><txp:if_expired><txp:else /><txp:article_id /></txp:if_expired></txp:article_custom>'/>
<txp:variable name="exhibitionsY" value='<txp:article_custom time="future" section="visual-arts" limit="1" break=","><txp:article_id /></txp:article_custom>'/>
<txp:variable name="educationX" value='<txp:article_custom time="any" section="education-listing" limit="5" break=","><txp:article_id /></txp:article_custom>'/>
<txp:variable name="eventsX" value='<txp:article_custom time="future" section="events" limit="5" break=","><txp:article_id /></txp:article_custom>'/>
<txp:article_custom id='<txp:variable name="exhibitionsX"/>,<txp:variable name="exhibitionsY"/>,<txp:variable name="educationX"/>,<txp:variable name="eventsX"/>' time="any" limit="99" >
<p><txp:section title="1" />: <txp:permlink><txp:title/></txp:permlink></p>
</txp:article_custom>
Yes, I have tried turning it off and on.
Offline
Pages: 1