5

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

Lindsey D
  • 23,974
  • 5
  • 53
  • 110
Steve Adams
  • 1,671
  • 2
  • 15
  • 27
  • 1
    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 '14 at 08:07

2 Answers2

11

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.

carlcs
  • 36,220
  • 5
  • 62
  • 139
3

Answer update for Craft 3, and also adding in a secondary orderBy so that remaining entries are still ordered by date:

{% set entries = craft.entries.section('news').orderBy('myLightswitch desc, postDate desc').all() %}

Without the secondary orderBy, I have no idea what it's using for the remainder sort order but it's not postDate in my testing at least!

James Smith
  • 5,154
  • 14
  • 15