Sort news by custom field

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
relic
Forum Members
Forum Members
Posts: 34
Joined: Fri Dec 08, 2006 9:59 am
Location: New Zealand

Sort news by custom field

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Sort news by custom field

Post by calguy1000 »

sorting or filtering by custom fields is not possible at this time.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
leslie894

Re: Sort news by custom field

Post 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.
User avatar
relic
Forum Members
Forum Members
Posts: 34
Joined: Fri Dec 08, 2006 9:59 am
Location: New Zealand

Re: Sort news by custom field

Post 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?
alby

Re: Sort news by custom field

Post 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
Post Reply

Return to “CMSMS Core”