Take the 2-minute tour ×
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It's 100% free, no registration required.

How would I make a post(s) sticky so that it appears first in the results and does not repeat later in the results?

share|improve this question
    
I'm surprised that this is not built in to Craft. –  pixelJitsu Aug 25 at 18:39
    
Obviously this could be done with two loops where one == sticky.field and the other is != sticky.field, but I was hoping for a more system level way to do this w/o having to use two loops everywhere it's needed. –  pixelJitsu Aug 25 at 19:00
    
Is there a way to sort by a field and then by postDate in the same loop? –  pixelJitsu Aug 25 at 19:40
    
FYI, your three comments are really all extensions of your original question. I'd recommend editing your question to include the entire train of thought... otherwise, you're really only having a conversation with yourself. –  Lindsey D Aug 26 at 8:07

1 Answer 1

up vote 5 down vote accepted

You could add a custom lightswitch field or similar and order your entries by that field.

{% set entries = craft.entries.section('news').order('myLightswitch desc') %}

If you need additional sort options, @Brad just shared how to do that with SQL in the order() parameter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.