Page 1 of 1

Sort news by custom field

Posted: Sun Apr 13, 2008 12:36 pm
by relic
Hi there,

i am running 1.2.3 "Black Rock".

I am wanting to display news items based on a custom field i have added.

The concept:
I want to have a "featured" news item displayed on the home page. The custom Field is called "Featured" and it is a tick box. So i am only wanting to display news items that have the featured tick box ticked.

I have tried: sortby="featured" and sortby="news_featured"

The Question:
Is this possible?

Thanks in advance

Re: Sort news by custom field

Posted: Sun Apr 13, 2008 3:18 pm
by calguy1000
sorting or filtering by custom fields is not possible at this time.

Re: Sort news by custom field

Posted: Sun Apr 13, 2008 6:12 pm
by leslie894
Create a new template for homepage news. In the template, check for the "featured" custom field. If it is present, carry through with outputting the html for the news item. if it is not present, do nothing. This is not as efficient as sorting on a custom field but it should have the desired output.

A better solution would be to use a "featured" category and then only display that category on the homepage.

Re: Sort news by custom field

Posted: Mon Apr 14, 2008 4:24 am
by relic
leslie894 wrote: A better solution would be to use a "featured" category and then only display that category on the homepage.
Yes that would be the best way to do it, but the issue is i will have to post news items twice as in one news item will be in the database twice which is just a hassle.

Is it possible to assign news items to more that one cat?

Re: Sort news by custom field

Posted: Mon Apr 14, 2008 6:48 am
by alby
relic wrote: Yes that would be the best way to do it, but the issue is i will have to post news items twice as in one news item will be in the database twice which is just a hassle.

Is it possible to assign news items to more that one cat?
No but you can display subcategories with "General*" (view help module) and one category with "General | Featured"

Alby