Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-01-04 16:35:27
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Look up articles based on custom field value?
Is there a way to find articles using a ‘where’ style search?
I want to find articles on a custom field with a certain value.
How can I do this?
Thanks
Rich
Offline
Re: Look up articles based on custom field value?
richtestani wrote:
I want to find articles on a custom field with a certain value.
Admin side: smd_where_used
Public side: smd_query
:-)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#3 2010-01-04 16:58:36
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Re: Look up articles based on custom field value?
Hi Stef – I notice your calendar plugin.
With that plugin, would I be able to output just the events (articles) by date/time in my own layout outside of a calendar layout?
I have date based articles that need to be sorted by date then time and im wondering if this would be an easier option than a custom query.
Thanks
Rich
So Ill need to find articles on this day and sort them by a time from a custom field (or does it work by posted date?)
Offline
Re: Look up articles based on custom field value?
richtestani wrote:
would I be able to output just the events (articles) by date/time in my own layout outside of a calendar layout?
You can use smd_article_events, yes, which works like article_custom. However…
I have date based articles that need to be sorted by date then time…
You can use <txp:article /> and <txp:article_custom /> to sort by a custom field. Might be better than a plugin.
sort them by a time from a custom field (or does it work by posted date?)
With smd_calendar you can nominate a custom field to hold your articles’ posted dates and sort by that. But check out the native tag solution first and see if it works before trying the plugin.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2010-01-04 17:39:14
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Re: Look up articles based on custom field value?
the problem i was having with the native tag, was i couldn’t search for articles based on values in a custom field. I could sort on it, but not search based on it.
I thought of using the posted date as the event date – but if events are in the future, and I set the posted date in the future, they wont display until that date – so future events are unknown until today.
Offline
#6 2010-01-04 17:41:17
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Look up articles based on custom field value?
Is there a reason you can’t use time="future"
?
Offline
#7 2010-01-04 17:45:58
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Re: Look up articles based on custom field value?
No reason – only because im unaware of this.
Is this in an article_custom tag?
How is this used?
Thanks
Rich
Offline
#8 2010-01-04 17:50:21
- richtestani
- Plugin Author
- Registered: 2009-11-08
- Posts: 128
Re: Look up articles based on custom field value?
Ok – i looked it up in the tag reference.
I think this may just do what I need.
Thanks
Rich
Offline
#9 2010-01-04 17:51:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Look up articles based on custom field value?
Both article and article_custom can have the time
attribute. Values can be past
, future
or any
. Wouldn’t know what else to explain ;)
Since the sort works for the entire posted date, it will also consider the time, not only the date. So no need for a custom field :)
Edit: ah, you found it :)
Last edited by els (2010-01-04 17:52:14)
Offline